Ejemplo n.º 1
0
        ///
        ///	 <summary> * fitsCompleteList - tests whether <code>value</code> matches the given
        ///	 * testlist (ListType=fitsCompleteList)
        ///	 *  </summary>
        ///	 * <param name="value">
        ///	 *            value to test </param>
        ///	 * <param name="list">
        ///	 *            testlist, either AllowedValueList or PresentValueList.
        ///	 *  </param>
        ///
        private bool fitsCompleteList(JDFShapeRangeList @value, JDFShapeRangeList list)
        {
            int v_size = @value.Count;
            int l_size = list.Count;

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

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

            JDFShapeRangeList valueList = new JDFShapeRangeList(@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);
        }
Ejemplo n.º 2
0
        ///
        ///	 <summary> * fitsCompleteOrderedList - tests whether <code>value</code> matches the
        ///	 * given testlist (ListType=CompleteOrderedList)
        ///	 *  </summary>
        ///	 * <param name="value">
        ///	 *            value to test </param>
        ///	 * <param name="list">
        ///	 *            testlist, either AllowedValueList or PresentValueList.
        ///	 *  </param>
        ///	 * <returns> boolean - true, if <code>value</code> matches the testlist </returns>
        ///
        private bool fitsCompleteOrderedList(JDFShapeRangeList @value, JDFShapeRangeList 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);
        }
Ejemplo n.º 3
0
        ///
        ///	 <summary> * fitsListType - checks whether <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 the specified value
        ///	 *         of ListType </returns>
        ///
        private bool fitsListType(string @value)
        {
            EnumListType listType = getListType();

            JDFShapeRangeList rangelist;

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

            if (listType.Equals(EnumListType.SingleValue) || listType.Equals(EnumListType.getEnum(0)))
            { // default ListType = SingleValue
                try
                {
                    new JDFShape(@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("JDFShapeEvaluation.fitsListType illegal ListType attribute");
            }
        }