Beispiel #1
0
        ///
        ///	 <summary> * fitsCompleteList - tests for the case, when ListType=CompleteList, if
        ///	 * <code>value</code> matches AllowedValueList or PresentValueList,
        ///	 * specified for this State
        ///	 *  </summary>
        ///	 * <param name="value">
        ///	 *            value to test </param>
        ///	 * <param name="list">
        ///	 *            testlists are either AllowedValueList or PresentValueList
        ///	 *  </param>
        ///	 * <returns> boolean - true, if <code>value</code> matches testlist </returns>
        ///
        private bool fitsCompleteList(JDFDateTimeRangeList @value, JDFDateTimeRangeList list)
        {
            int v_size = @value.Count;
            int l_size = list.Count;

            if (v_size != l_size)
            {
                return(false);
            }

            if ([email protected]())
            {
                return(false);
            }

            JDFDateTimeRangeList valueList = new JDFDateTimeRangeList(@value);

            bool bFound;

            for (int i = l_size - 1; i >= 0; i--)
            {
                bFound = false;
                for (int j = valueList.Count - 1; j >= 0; j--)
                {
                    if (list[i].Equals(valueList[j]))
                    {
                        valueList.erase(j);
                        bFound = true;
                        break;
                    }
                }
                if (!bFound)
                {
                    return(false);
                }
            }
            return(true);
        }
Beispiel #2
0
        ///
        ///	 <summary> * fitsCompleteOrderedList - tests for the case, when
        ///	 * ListType=CompleteOrderedList, if the defined 'value' matches
        ///	 * AllowedValueList or PresentValueList, specified for this State
        ///	 *  </summary>
        ///	 * <param name="value">
        ///	 *            value to test </param>
        ///	 * <param name="list">
        ///	 *            testlists are either AllowedValueList or PresentValueList
        ///	 *  </param>
        ///	 * <returns> boolean - true, if <code>value</code> matches testlist </returns>
        ///
        private bool fitsCompleteOrderedList(JDFDateTimeRangeList @value, JDFDateTimeRangeList list)
        {
            int v_size = @value.Count;
            int l_size = list.Count;

            if (v_size != l_size)
            {
                return(false);
            }

            if ([email protected]())
            {
                return(false);
            }

            for (int i = 0; i < l_size; i++)
            {
                if (!list[i].Equals(@value[i]))
                {
                    return(false);
                }
            }
            return(true);
        }
///
///	 <summary> * fitsListType - tests, if the defined <code>value</code> matches the value
///	 * of the ListType attribute, specified for this Evaluation
///	 *  </summary>
///	 * <param name="value">
///	 *            value to test </param>
///	 * <returns> boolean - true, if <code>value</code> matches specified ListType </returns>
///
        private bool fitsListType(string @value)
        {
            EnumListType listType = getListType();

            JDFDateTimeRangeList rangelist;

            try
            {
                rangelist = new JDFDateTimeRangeList(@value);
            }
            catch (FormatException)
            {
                return(false);
            }
            catch (JDFException)
            {
                return(false);
            }

            if (listType.Equals(EnumListType.SingleValue) || listType.Equals(EnumListType.getEnum(0)))
            { // default ListType = SingleValue
                if (@value.IndexOf("P") != 0)
                {
                    return(false);
                }

                try
                {
                    new JDFDate(@value);
                }
                catch (JDFException)
                {
                    return(false);
                }
                catch (FormatException)
                {
                    return(false);
                }

                return(true);
            }
            else if (listType.Equals(EnumListType.RangeList) || listType.Equals(EnumListType.Span))
            {
                return(true);
            }
            else if (listType.Equals(EnumListType.List))
            {
                return(rangelist.isList());
            }
            else if (listType.Equals(EnumListType.OrderedList))
            {
                return(rangelist.isList() && rangelist.isOrdered());
            }
            else if (listType.Equals(EnumListType.UniqueList))
            {
                return(rangelist.isList() && rangelist.isUnique());
            }
            else if (listType.Equals(EnumListType.UniqueOrderedList))
            {
                return(rangelist.isList() && rangelist.isUniqueOrdered());
            }
            else if (listType.Equals(EnumListType.OrderedRangeList))
            {
                return(rangelist.isOrdered());
            }
            else if (listType.Equals(EnumListType.UniqueRangeList))
            {
                return(rangelist.isUnique());
            }
            else if (listType.Equals(EnumListType.UniqueOrderedRangeList))
            {
                return(rangelist.isUniqueOrdered());
            }
            else
            {
                throw new JDFException("JDFDateTimeEvaluation.fitsListType illegal ListType attribute");
            }
        }