Beispiel #1
0
        ///
        ///	 <summary> * fitsListType - checks whether <code>matrixList</code> matches the value
        ///	 * of the ListType attribute specified for this State
        ///	 *  </summary>
        ///	 * <param name="matrixList">
        ///	 *            vector of matrices to test
        ///	 *  </param>
        ///	 * <returns> boolean - true, if 'value' matches specified ListType </returns>
        ///
        private bool fitsListType(List <JDFMatrix> matrixList)
        {
            EnumListType listType = getListType();

            int size = matrixList.Count;

            if (listType.Equals(EnumListType.SingleValue) || listType.Equals(EnumListType.getEnum(0)))
            { // default ListType = SingleValue
                return(size == 1);
            }
            else if (listType.Equals(EnumListType.List))
            {
                return(true);
            }
            else if (listType.Equals(EnumListType.UniqueList))
            {
                for (int i = 0; i < size; i++)
                {
                    for (int j = i + 1; j < size; j++)
                    {
                        JDFMatrix mi = matrixList[i];
                        JDFMatrix mj = matrixList[j];
                        if (mi.Equals(mj))
                        {
                            return(false);
                        }
                    }
                }
                return(true);
            }
            else
            {
                throw new JDFException("JDFMatrixState.fitsListType illegal ListType attribute");
            }
        }
Beispiel #2
0
        ///
        ///	 <summary> * fitsListType - checks whether <code>matrixList</code> matches the
        ///	 * ListType attribute specified for this Evaluation
        ///	 *  </summary>
        ///	 * <param name="matrixList">
        ///	 *            value to test </param>
        ///	 * <returns> boolean - true, if <code>matrixList</code> matches specified
        ///	 *         value of ListType </returns>
        ///
        private bool fitsListType(VString matrixList)
        {
            EnumListType listType = getListType();

            int size = matrixList.Count;

            for (int i = 0; i < size; i++)
            {
                try
                {
                    new JDFMatrix(matrixList[i]);
                }
                catch (JDFException)
                {
                    return(false);
                }
                catch (FormatException)
                {
                    return(false);
                }
            }

            if (listType.Equals(EnumListType.SingleValue) || listType.Equals(EnumListType.getEnum(0)))
            { // default ListType = SingleValue
                return(size == 1);
            }
            else if (listType.Equals(EnumListType.List))
            {
                return(true);
            }
            else if (listType.Equals(EnumListType.UniqueList))
            {
                for (int i = 0; i < size; i++)
                {
                    for (int j = 0; j < size; j++)
                    {
                        if (j != i)
                        {
                            string mi = matrixList[i];
                            string mj = matrixList[j];
                            if (mi.CompareTo(mj) == 0)
                            {
                                return(false);
                            }
                        }
                    }
                }
                return(true);
            }
            else
            {
                throw new JDFException("JDFMatrixEvaluation.fitsListType illegal ListType attribute");
            }
        }
Beispiel #3
0
///
///	 <summary> * fitsListType - tests, if the defined 'value' matches value of ListType
///	 * attribute, specified for this Evaluation
///	 *  </summary>
///	 * <param name="value">
///	 *            value to test </param>
///	 * <returns> boolean - true, if 'value' matches specified value of ListType </returns>
///
        private bool fitsListType(string @value)
        {
            VString vBool = new VString(@value, null);
            int     size  = vBool.Count;

            for (int i = 0; i < size; i++)
            {
                if (!StringUtil.isBoolean(vBool[i]))
                {
                    return(false);
                }
            }

            EnumListType listType = getListType();

            if (listType.Equals(EnumListType.SingleValue) || listType.Equals(EnumListType.getEnum(0)))
            { // default ListType = SingleValue
                return(size == 1);
            }
            else if (listType.Equals(EnumListType.List) || listType.Equals(EnumListType.Span))
            {
                return(true);
            }
            else if (listType.Equals(EnumListType.UniqueList))
            {
                for (int i = 0; i < size; i++)
                {
                    for (int j = 0; j < size; j++)
                    {
                        if (j != i)
                        {
                            string bi = vBool[i];
                            string bj = vBool[j];
                            if (bi.CompareTo(bj) == 0)
                            {
                                return(false);
                            }
                        }
                    }
                }
                return(true);
            }
            else
            {
                throw new JDFException("JDFBooleanEvaluation.fitsListType illegal ListType attribute");
            }
        }
Beispiel #4
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)
        {
            if (!StringUtil.isNMTOKENS(@value, false))
            {
                return(false);
            }

            EnumListType listType = getListType();

            if (listType == null)
            {
                return(true);
            }

            if (listType.Equals(EnumListType.SingleValue) || listType.Equals(EnumListType.getEnum(0)))
            { // default ListType = SingleValue
                return(StringUtil.isNMTOKEN(@value));
            }
            // not -
            // tested in
            // fitsValueList
            // in
            // fitsValueList
            else if (listType.Equals(EnumListType.List) || listType.Equals(EnumListType.Span) || listType.Equals(EnumListType.CompleteList) || listType.Equals(EnumListType.CompleteOrderedList) || listType.Equals(EnumListType.ContainedList)) // tested in
            // fitsValueList
            // )
            {
                return(true);
            }
            else if (listType.Equals(EnumListType.UniqueList))
            {
                VString v = new VString(@value, null);
                return(isUnique(v));
            }
            else
            {
                throw new JDFException("JDFNameEvaluation.fitsListType illegal ListType attribute");
            }
        }
///
///	 <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");
            }
        }
Beispiel #6
0
 ///
 ///	 <summary> * Gets typesafe enumerated attribute ListType
 ///	 *  </summary>
 ///	 * <returns> EnumListType: the enumeration value of the attribute </returns>
 ///
 public virtual EnumListType getListType()
 {
     return(EnumListType.getEnum(getAttribute(AttributeName.LISTTYPE, null, EnumListType.SingleValue.getName())));
 }
Beispiel #7
0
 static JDFAbstractState()
 {
     atrInfoTable[0]  = new AtrInfoTable(AttributeName.AVAILABILITY, 0x33333311, AttributeInfo.EnumAttributeType.enumeration, EnumAvailability.getEnum(0), null);
     atrInfoTable[1]  = new AtrInfoTable(AttributeName.ACTIONREFS, 0x33333311, AttributeInfo.EnumAttributeType.IDREFS, null, null);
     atrInfoTable[2]  = new AtrInfoTable(AttributeName.DEPENDENTMACROREF, 0x33333311, AttributeInfo.EnumAttributeType.IDREF, null, null);
     atrInfoTable[3]  = new AtrInfoTable(AttributeName.DEVNS, 0x33333331, AttributeInfo.EnumAttributeType.URI, null, JDFConstants.JDFNAMESPACE);
     atrInfoTable[4]  = new AtrInfoTable(AttributeName.EDITABLE, 0x33333311, AttributeInfo.EnumAttributeType.boolean_, null, JDFConstants.TRUE);
     atrInfoTable[5]  = new AtrInfoTable(AttributeName.HASDEFAULT, 0x33333331, AttributeInfo.EnumAttributeType.boolean_, null, JDFConstants.TRUE);
     atrInfoTable[6]  = new AtrInfoTable(AttributeName.ID, 0x33333311, AttributeInfo.EnumAttributeType.ID, null, null);
     atrInfoTable[7]  = new AtrInfoTable(AttributeName.LISTTYPE, 0x33333311, AttributeInfo.EnumAttributeType.enumeration, EnumListType.getEnum(0), EnumListType.SingleValue.getName());
     atrInfoTable[8]  = new AtrInfoTable(AttributeName.MACROREFS, 0x33333311, AttributeInfo.EnumAttributeType.IDREFS, null, null);
     atrInfoTable[9]  = new AtrInfoTable(AttributeName.MAXOCCURS, 0x33333311, AttributeInfo.EnumAttributeType.unbounded, null, "1");
     atrInfoTable[10] = new AtrInfoTable(AttributeName.MINOCCURS, 0x33333311, AttributeInfo.EnumAttributeType.integer, null, "1");
     atrInfoTable[11] = new AtrInfoTable(AttributeName.MODULEREFS, 0x33333111, AttributeInfo.EnumAttributeType.IDREFS, null, null);
     atrInfoTable[12] = new AtrInfoTable(AttributeName.NAME, 0x33333331, AttributeInfo.EnumAttributeType.NMTOKEN, null, null);
     atrInfoTable[13] = new AtrInfoTable(AttributeName.REQUIRED, 0x33333311, AttributeInfo.EnumAttributeType.boolean_, null, null);
     atrInfoTable[14] = new AtrInfoTable(AttributeName.SPAN, 0x44444431, AttributeInfo.EnumAttributeType.boolean_, null, null);
     atrInfoTable[15] = new AtrInfoTable(AttributeName.USERDISPLAY, 0x33333311, AttributeInfo.EnumAttributeType.enumeration, EnumUserDisplay.getEnum(0), EnumUserDisplay.Display.getName());
     elemInfoTable[0] = new ElemInfoTable(ElementName.LOC, 0x33333311);
 }