Beispiel #1
0
        public virtual EnumAttributeType getAtrType(string attributeName)
        {
            AtrInfo ai = (AtrInfo)attribInfoTable[attributeName];

            if (ai == null)
            {
                return(null);
            }
            return(ai.getAtrType());
        }
Beispiel #2
0
        public virtual void testgetFirstLastVersion()
        {
            AtrInfo ai = new AtrInfo(0x44433211, AttributeInfo.EnumAttributeType.boolean_, null, null);

            Assert.AreEqual(EnumVersion.Version_1_2, ai.getFirstVersion(), "");
            Assert.AreEqual(EnumVersion.Version_1_4, ai.getLastVersion(), "");

            ai = new AtrInfo(0x33333222, AttributeInfo.EnumAttributeType.boolean_, null, null);
            Assert.AreEqual(EnumVersion.Version_1_0, ai.getFirstVersion(), "");
            Assert.AreEqual(EnumVersion.Version_1_7, ai.getLastVersion(), "");
        }
Beispiel #3
0
        ///
        ///	 <summary> * Returns true if there is at least one attribute matching the requested validity for the specified JDF version.
        ///	 *  </summary>
        ///	 * <param name="EnumAttributeValidity"> attrValidity: requested validity </param>
        ///	 * <returns> boolean: true if at least one attribute matches the requested validity </returns>
        ///
        public virtual bool hasConformingAttrib(EnumAttributeValidity attrValidity)
        {
            IEnumerator iter = attribInfoTable.Keys.GetEnumerator();

            long l2 = JDFVersions.getTheMask(version);
            long v2 = JDFVersions.getTheOffset(version);

            while (iter.MoveNext())
            {
                AtrInfo ai = (AtrInfo)attribInfoTable[iter.Current];
                if ((ai.getAtrValidityStatus() & l2) == ((long)attrValidity.getValue() << (int)v2))
                {
                    return(true);
                }
            }

            return(false);
        }
Beispiel #4
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);
        }
Beispiel #5
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);
        }
Beispiel #6
0
        ///
        ///	 * <param name="n"> </param>
        ///	 * <param name="s"> </param>
        ///	 * <param name="t"> </param>
        ///	 * <param name="e"> </param>
        ///

        public AtrInfoTable(string n, long s, AttributeInfo.EnumAttributeType t, ValuedEnum e, string def)
        {
            attributeName = n;
            info          = new AtrInfo(s, t, e, def);
        }