Ejemplo n.º 1
0
        ///
        ///	 <summary> * fitsValueElem - tests, if JDFMatrix <code>matrix</code> matches
        ///	 * subelement Value, specified for this State
        ///	 *  </summary>
        ///	 * <param name="matrix">
        ///	 *            JDFMatrix to test </param>
        ///	 * <param name="valuelist">
        ///	 *            switches between Allowed and Present configuration in
        ///	 *            subelement Value.
        ///	 *  </param>
        ///	 * <returns> boolean - true, if <code>matrix</code> matches subelement Value </returns>
        ///
        private bool fitsValueElem(JDFMatrix matrix, EnumFitsValue valuelist)
        {
            VElement v        = getChildElementVector(ElementName.VALUE, null, null, true, 0, false);
            int      siz      = v.Count;
            bool     hasValue = false;

            for (int i = 0; i < siz; i++)
            {
                JDFValue elm = (JDFValue)v[i];
                if (elm.hasAttribute(AttributeName.VALUEUSAGE))
                {
                    EnumFitsValue valueUsage = getValueValueUsage(i);
                    if (valuelist.Equals(valueUsage))
                    {
                        hasValue = true;
                        JDFMatrix @value = getValueAllowedValue(i);
                        if (@value.Equals(matrix))
                        {
                            return(true); // we have found it
                        }
                    }
                }
                else
                {
                    hasValue = true;
                    JDFMatrix @value = getValueAllowedValue(i);
                    if (@value.Equals(matrix))
                    {
                        return(true); // we have found it
                    }
                }
            }
            return(!hasValue); // if no matching, there was no filter
        }
Ejemplo n.º 2
0
        ///
        ///	 <summary> * fitsValueElem - checks whether <code>pdfPath</code> matches the
        ///	 * subelement <code>Value</code> specified for this State
        ///	 *  </summary>
        ///	 * <param name="pdfPath">
        ///	 *            PDFPath to test </param>
        ///	 * <param name="valueusage">
        ///	 *            switches between Allowed and Present configuration in
        ///	 *            subelement <code>Value</code>.
        ///	 *  </param>
        ///	 * <returns> boolean - true, if <code>pdfPath</code> matches subelement
        ///	 *         <code>Value</code> </returns>
        ///
        private bool fitsValueElem(string pdfPath, EnumFitsValue valuelist)
        {
            VElement v        = getChildElementVector(ElementName.VALUE, null, null, true, 0, false);
            int      siz      = v.Count;
            bool     hasValue = false;

            for (int i = 0; i < siz; i++)
            {
                JDFValue elm = (JDFValue)v[i];
                if (elm.hasAttribute(AttributeName.VALUEUSAGE))
                {
                    EnumFitsValue valueUsage = getValueValueUsage(i);
                    if (valuelist.Equals(valueUsage))
                    {
                        hasValue = true;
                        string @value = getValueAllowedValue(i);
                        if (@value.CompareTo(pdfPath) == 0)
                        {
                            return(true); // we have found it
                        }
                    }
                }
                else
                {
                    hasValue = true;
                    string @value = getValueAllowedValue(i);
                    if (@value.CompareTo(pdfPath) == 0)
                    {
                        return(true); // we have found it
                    }
                }
            }
            return(!hasValue);
        }
Ejemplo n.º 3
0
        //
        //	 * (non-Javadoc)
        //	 *
        //	 * @see
        //	 * org.cip4.jdflib.resource.devicecapability.JDFAbstractState#addValue(java
        //	 * .lang.String, org.cip4.jdflib.datatypes.JDFBaseDataTypes.EnumFitsValue)
        //
        public override void addValue(string @value, EnumFitsValue testlists)
        {
            if (fitsValue(@value, testlists))
            {
                return;
            }

            try
            {
                new JDFMatrix(@value);
            }
            catch (FormatException)
            {
                return; // nop for bad values
            }
            if (testlists == null || EnumFitsValue.Allowed.Equals(testlists))
            {
                JDFValue v = appendValue();
                v.setAllowedValue(@value);
                if (testlists != null)
                {
                    v.setValueUsage(EnumValueUsage.Allowed);
                }
            }
            if (EnumFitsValue.Present.Equals(testlists))
            {
                JDFValue v = appendValue();
                v.setAllowedValue(@value);
                if (testlists != null)
                {
                    v.setValueUsage(EnumValueUsage.Present);
                }
            }
        }
Ejemplo n.º 4
0
        //
        //	 * (non-Javadoc)
        //	 *
        //	 * @see
        //	 * org.cip4.jdflib.resource.devicecapability.JDFAbstractState#addValue(java
        //	 * .lang.String, org.cip4.jdflib.datatypes.JDFBaseDataTypes.EnumFitsValue)
        //
        public override void addValue(string @value, EnumFitsValue testlists)
        {
            if (fitsValue(@value, testlists))
            {
                return;
            }

            if (testlists == null || EnumFitsValue.Allowed.Equals(testlists))
            {
                JDFValue v = appendValue();
                v.setAllowedValue(@value);
                if (testlists != null)
                {
                    v.setValueUsage(EnumValueUsage.Allowed);
                }
            }
            if (EnumFitsValue.Present.Equals(testlists))
            {
                JDFValue v = appendValue();
                v.setAllowedValue(@value);
                if (testlists != null)
                {
                    v.setValueUsage(EnumValueUsage.Present);
                }
            }
        }
Ejemplo n.º 5
0
        ///
        ///	 <summary> * append a <code>Value</code> element and set Value/@Value to value
        ///	 *  </summary>
        ///	 * <param name="value">
        ///	 *            the value string to set
        ///	 *  </param>
        ///	 * <returns> JDFValue - the newly created element </returns>
        ///
        public virtual JDFValue appendValueValue(string @value)
        {
            JDFValue v = (JDFValue)appendElement(ElementName.VALUE, null);

            v.setValue(@value);
            return(v);
        }
Ejemplo n.º 6
0
        //
        //	 * // Subelement attribute and element Getter / Setter
        //

        ///
        ///	 <summary> * Gets the jSkip'th element <code>Loc</code> of the iSkip'th element
        ///	 * <code>Value</code>
        ///	 *  </summary>
        ///	 * <param name="iSkip">
        ///	 *            number of <code>Value</code> elements to skip (iSkip=0 ->
        ///	 *            first <code>Value</code> element) </param>
        ///	 * <param name="jSkip">
        ///	 *            number of <code>Loc</code> subelements of iSkip'th
        ///	 *            <code>Value</code> element to skip (jSkip=0 -> first
        ///	 *            <code>Loc</code> element) </param>
        ///	 * <returns> JDFLoc: the matching Loc element </returns>
        ///
        public override JDFLoc getValueLocLoc(int iSkip, int jSkip)
        {
            JDFValue val = (JDFValue)getElement(ElementName.VALUE, null, iSkip);
            JDFLoc   loc = (JDFLoc)val.getElement(ElementName.LOC, null, jSkip);

            return(loc);
        }
Ejemplo n.º 7
0
        ///
        ///	 <summary> * Appends element <code>Loc</code> to the end of the iSkip'th subelement
        ///	 * <code>Value</code>
        ///	 *  </summary>
        ///	 * <param name="iSkip">
        ///	 *            number of <code>Value</code> elements to skip (iSkip=0 ->
        ///	 *            first Value element) </param>
        ///	 * <returns> JDFLoc: newly created <code>Loc</code> element </returns>
        ///
        public override JDFLoc appendValueLocLoc(int iSkip)
        {
            JDFValue val = getValue(iSkip);

            if (val == null)
            {
                return(null);
            }
            return(val.appendLoc());
        }
Ejemplo n.º 8
0
        //
        //	 * // Subelement attribute and element Getter / Setter
        //

        ///
        ///	 <summary> * Gets the jSkip'th element <code>Loc</code> of the iSkip'th element
        ///	 * <code>Value</code>
        ///	 *  </summary>
        ///	 * <param name="iSkip">
        ///	 *            : number of <code>Value</code> elements to skip (iSkip=0 ->
        ///	 *            first <code>Value</code> element) </param>
        ///	 * <param name="int"> jSkip: number of <code>Loc</code> subelements of the iSkip'th
        ///	 *        <code>Value</code> element to skip, (jSkip=0 -> first
        ///	 *        <code>Loc</code> element) </param>
        ///	 * <returns> JDFLoc: the matching <code>Loc</code> element </returns>
        ///
        public JDFLoc getValueLoc(int iSkip, int jSkip)
        {
            JDFValue val = getValue(iSkip);

            if (val == null)
            {
                return(null);
            }
            return(val.getLoc(jSkip));
        }
Ejemplo n.º 9
0
        ///
        ///	 <summary> * Gets the <code>Value</code> attribute of the iSkip'th subelement
        ///	 * <code>Value</code>
        ///	 *  </summary>
        ///	 * <param name="iSkip">
        ///	 *            the number of <code>Value</code> elements to skip </param>
        ///	 * <returns> String: the attribute value, <code>null</code> if no matching
        ///	 *         value element exists </returns>
        ///
        public string getValueValue(int iSkip)
        {
            JDFValue e = (JDFValue)getElement(ElementName.VALUE, null, iSkip);

            if (e == null)
            {
                return(null);
            }
            return(e.getValue());
        }
Ejemplo n.º 10
0
        ///
        ///	 <summary> * Gets the <code>Value</code> attribute of the i-th subelement Value
        ///	 *  </summary>
        ///	 * <param name="iSkipthe">
        ///	 *            number of Value elements to skip </param>
        ///	 * <returns> JDFMatrix: the attribute value </returns>
        ///
        public JDFMatrix getValueValue(int iSkip)
        {
            JDFValue e = (JDFValue)getElement(ElementName.VALUE, null, iSkip);

            try
            {
                return(new JDFMatrix(e.getValue()));
            }
            catch (FormatException)
            {
                throw new JDFException("JDFMatrixState.getValueValue: AttributeValue not capable to create JDFMatrix");
            }
        }
Ejemplo n.º 11
0
        ///
        ///     <summary> * Get all Value from the current element
        ///     *  </summary>
        ///     * <returns> Collection<JDFValue> </returns>
        ///
        public virtual ICollection <JDFValue> getAllValue()
        {
            List <JDFValue> v = new List <JDFValue>();

            JDFValue kElem = (JDFValue)getFirstChildElement(ElementName.VALUE, null);

            while (kElem != null)
            {
                v.Add(kElem);

                kElem = (JDFValue)kElem.getNextSiblingElement(ElementName.VALUE, null);
            }

            return(v);
        }
Ejemplo n.º 12
0
 public virtual void appendValue(JDFMatrix @value, EnumFitsValue testlists)
 {
     if (testlists == null || EnumFitsValue.Allowed.Equals(testlists))
     {
         JDFValue v = appendValue();
         v.setAllowedValue(@value.ToString());
         if (testlists != null)
         {
             v.setValueUsage(EnumValueUsage.Allowed);
         }
     }
     if (EnumFitsValue.Present.Equals(testlists))
     {
         JDFValue v = appendValue();
         v.setAllowedValue(@value.ToString());
         if (testlists != null)
         {
             v.setValueUsage(EnumValueUsage.Present);
         }
     }
 }
Ejemplo n.º 13
0
        public virtual JDFValue getValue(int iSkip)
        {
            JDFValue e = (JDFValue)getElement(ElementName.VALUE, JDFConstants.EMPTYSTRING, iSkip);

            return(e);
        }
Ejemplo n.º 14
0
        ///
        ///	 <summary> * Sets the <code>AllowedValue</code> attribute of the iSkip'th subelement
        ///	 * <code>Value</code>
        ///	 *  </summary>
        ///	 * <param name="value">
        ///	 *            value to set the attribute to </param>
        ///
        public virtual void appendValueAllowedValue(string @value)
        {
            JDFValue e = (JDFValue)appendElement(ElementName.VALUE, null);

            e.setAllowedValue(@value);
        }
Ejemplo n.º 15
0
        ///
        ///	 <summary> * Gets the value of attribute ValueUsage of the iSkip'th subelement
        ///	 * <code>Value</code>
        ///	 *  </summary>
        ///	 * <param name="iSkip">
        ///	 *            the number of <code>Value</code> elements to skip </param>
        ///	 * <returns> EnumFitsValue: the attribute value </returns>
        ///
        public EnumFitsValue getValueValueUsage(int iSkip)
        {
            JDFValue e = (JDFValue)getElement(ElementName.VALUE, null, iSkip);

            return(EnumFitsValue.getEnum(e.getValueUsage().getName()));
        }
Ejemplo n.º 16
0
        ///
        ///	 <summary> * Sets the ValueUsage attribute of the iSkip'th subelement
        ///	 * <code>Value</code>
        ///	 *  </summary>
        ///	 * <param name="iSkip">
        ///	 *            the number of <code>Value</code> elements to skip </param>
        ///	 * <param name="value">
        ///	 *            value to set the attribute to </param>
        ///
        public virtual void setValueValueUsage(int iSkip, EnumFitsValue @value)
        {
            JDFValue e = (JDFValue)getElement(ElementName.VALUE, null, iSkip);

            e.setValueUsage(EnumValueUsage.getEnum(@value.getName()));
        }
Ejemplo n.º 17
0
        ///
        ///	 <summary> * Gets the AllowedValue attribute of the iSkip'th subelement
        ///	 * <code>Value</code>
        ///	 *  </summary>
        ///	 * <param name="iSkip">
        ///	 *            the number of <code>Value</code> elements to skip </param>
        ///	 * <returns> String: the attribute value </returns>
        ///
        public string getValueAllowedValue(int iSkip)
        {
            JDFValue e = (JDFValue)getElement(ElementName.VALUE, null, iSkip);

            return(e.getAllowedValue());
        }
Ejemplo n.º 18
0
        ///
        ///	 <summary> * Sets the AllowedValue attribute of the i-th subelement <code>Value</code>
        ///	 *  </summary>
        ///	 * <param name="iSkip">
        ///	 *            the number of <code>Value</code> elements to skip </param>
        ///	 * <param name="value">
        ///	 *            value to set the attribute to </param>
        ///
        public virtual void setValueAllowedValue(int iSkip, string @value)
        {
            JDFValue e = (JDFValue)getElement(ElementName.VALUE, null, iSkip);

            e.setAllowedValue(@value);
        }
Ejemplo n.º 19
0
        //
        //	 * // Subelement attribute and element Getter / Setter
        //

        //
        //	 * // Subelement attribute and element Getter / Setter
        //

        ///
        ///	 <summary> * Sets the <code>Value</code> attribute of the i-th subelement Value
        ///	 *  </summary>
        ///	 * <param name="iSkip">
        ///	 *            the number of Value elements to skip </param>
        ///	 * <param name="value">
        ///	 *            value to set the attribute to </param>
        ///
        public virtual void setValueValue(int iSkip, JDFMatrix @value)
        {
            JDFValue e = (JDFValue)getElement(ElementName.VALUE, null, iSkip);

            e.setValue(@value.ToString());
        }
Ejemplo n.º 20
0
        //
        //	 * // Element getter / setter
        //

        public virtual JDFValue getValue(int iSkip)
        {
            JDFValue e = (JDFValue)getElement(ElementName.VALUE, null, iSkip);

            return(e);
        }