예제 #1
0
        ///
        ///	 <summary> * Returns a list of attributes matching the requested validity for the specified JDF version.
        ///	 *  </summary>
        ///	 * <param name="EnumAttributeValidity"> attrValidity: requested validity </param>
        ///	 * <returns> VString: list of strings containing the names of the matching attributes </returns>
        ///
        public virtual VString conformingAttribs(EnumAttributeValidity attrValidity)
        {
            VString matchingAttribs = new VString();
            long    l2 = JDFVersions.getTheMask(version);
            long    v2 = JDFVersions.getTheOffset(version);

            IEnumerator iter = attribInfoTable.Keys.GetEnumerator();
            bool        bOK  = attrValidity == null;

            while (iter.MoveNext())
            {
                string  theKey = (string)iter.Current;
                AtrInfo ai     = (AtrInfo)attribInfoTable[theKey];
                if (bOK)
                {
                    matchingAttribs.Add(theKey);
                }
                else
                {
                    if (attrValidity != null)
                    {
                        // grab values from tables
                        long l1 = ai.getAtrValidityStatus();
                        long l3 = l1 & l2;

                        // calculate correct mask from attrValidity and version
                        long v1 = attrValidity.getValue();
                        long v3 = v1 << (int)v2;

                        // tables and version coincide
                        if (l3 == v3)
                        {
                            matchingAttribs.Add(theKey);
                        }
                    }
                }
            }

            return(matchingAttribs);
        }
예제 #2
0
        ///
        ///	 <summary> * Returns a map of attributes with defaults for the specified JDF version.
        ///	 *  </summary>
        ///	 * <returns> JDFAttributeMap: map of strings containing the names and defaults of the matching attributes, null if no
        ///	 *         defaults exist </returns>
        ///
        public virtual JDFAttributeMap getDefaultAttributeMap()
        {
            JDFAttributeMap matchingAttribs = new JDFAttributeMap();

            IEnumerator iter = attribInfoTable.Keys.GetEnumerator();

            while (iter.MoveNext())
            {
                string  theKey = (string)iter.Current;
                AtrInfo ai     = (AtrInfo)attribInfoTable[theKey];
                long    l2     = JDFVersions.getTheMask(version);
                long    v2     = JDFVersions.getTheOffset(version);
                EnumAttributeValidity versionVal = EnumAttributeValidity.getEnum((int)((ai.getAtrValidityStatus() & l2) >> (int)v2));
                if (versionVal.Equals(EnumAttributeValidity.Optional) || versionVal.Equals(EnumAttributeValidity.Required))
                {
                    string def = ai.getAtrDefault();
                    if (def != null)
                    {
                        matchingAttribs.put(theKey, def);
                    }
                }
            }
            return(matchingAttribs.IsEmpty() ? null : matchingAttribs);
        }