Exemple #1
0
        public void testSetDefaultValue()
        {
            JDFNumberList integerList = new JDFNumberList("1 2 3");

            iState.setDefaultValue(integerList);
            Assert.AreEqual(integerList, iState.getDefaultValue());
            iState.setDefaultValue(1);
            Assert.AreEqual(new JDFNumberList("1"), iState.getDefaultValue());
        }
 ///        
 ///          <summary> * (20) get JDFNumberList attribute DividePositions </summary>
 ///          * <returns> JDFNumberList the value of the attribute, null if a the
 ///          *         attribute value is not a valid to create a JDFNumberList </returns>
 ///          
 public virtual JDFNumberList getDividePositions()
 {
    string strAttrName = "";
    JDFNumberList nPlaceHolder = null;
    strAttrName = getAttribute(AttributeName.DIVIDEPOSITIONS, null, JDFConstants.EMPTYSTRING);
    try
    {
       nPlaceHolder = new JDFNumberList(strAttrName);
    }
    catch (FormatException)
    {
       return null;
    }
    return nPlaceHolder;
 }
Exemple #3
0
        ///
        ///          <summary> * (20) get JDFNumberList attribute Percentages </summary>
        ///          * <returns> JDFNumberList the value of the attribute, null if a the
        ///          *         attribute value is not a valid to create a JDFNumberList </returns>
        ///
        public virtual JDFNumberList getPercentages()
        {
            string        strAttrName  = "";
            JDFNumberList nPlaceHolder = null;

            strAttrName = getAttribute(AttributeName.PERCENTAGES, null, JDFConstants.EMPTYSTRING);
            try
            {
                nPlaceHolder = new JDFNumberList(strAttrName);
            }
            catch (FormatException)
            {
                return(null);
            }
            return(nPlaceHolder);
        }
        ///
        ///          <summary> * (20) get JDFNumberList attribute FountainPositions </summary>
        ///          * <returns> JDFNumberList the value of the attribute, null if a the
        ///          *         attribute value is not a valid to create a JDFNumberList </returns>
        ///
        public virtual JDFNumberList getFountainPositions()
        {
            string        strAttrName  = "";
            JDFNumberList nPlaceHolder = null;

            strAttrName = getAttribute(AttributeName.FOUNTAINPOSITIONS, null, JDFConstants.EMPTYSTRING);
            try
            {
                nPlaceHolder = new JDFNumberList(strAttrName);
            }
            catch (FormatException)
            {
                return(null);
            }
            return(nPlaceHolder);
        }
Exemple #5
0
        ///
        ///          <summary> * (20) get JDFNumberList attribute NumberValue </summary>
        ///          * <returns> JDFNumberList the value of the attribute, null if a the
        ///          *         attribute value is not a valid to create a JDFNumberList </returns>
        ///
        public virtual JDFNumberList getNumberValue()
        {
            string        strAttrName  = "";
            JDFNumberList nPlaceHolder = null;

            strAttrName = getAttribute(AttributeName.NUMBERVALUE, null, JDFConstants.EMPTYSTRING);
            try
            {
                nPlaceHolder = new JDFNumberList(strAttrName);
            }
            catch (FormatException)
            {
                return(null);
            }
            return(nPlaceHolder);
        }
        ///
        ///          <summary> * (20) get JDFNumberList attribute ZoneSettingsY </summary>
        ///          * <returns> JDFNumberList the value of the attribute, null if a the
        ///          *         attribute value is not a valid to create a JDFNumberList </returns>
        ///
        public virtual JDFNumberList getZoneSettingsY()
        {
            string        strAttrName  = "";
            JDFNumberList nPlaceHolder = null;

            strAttrName = getAttribute(AttributeName.ZONESETTINGSY, null, JDFConstants.EMPTYSTRING);
            try
            {
                nPlaceHolder = new JDFNumberList(strAttrName);
            }
            catch (FormatException)
            {
                return(null);
            }
            return(nPlaceHolder);
        }
        ///
        ///          <summary> * (20) get JDFNumberList attribute WorkingList </summary>
        ///          * <returns> JDFNumberList the value of the attribute, null if a the
        ///          *         attribute value is not a valid to create a JDFNumberList </returns>
        ///
        public virtual JDFNumberList getWorkingList()
        {
            string        strAttrName  = "";
            JDFNumberList nPlaceHolder = null;

            strAttrName = getAttribute(AttributeName.WORKINGLIST, null, JDFConstants.EMPTYSTRING);
            try
            {
                nPlaceHolder = new JDFNumberList(strAttrName);
            }
            catch (FormatException)
            {
                return(null);
            }
            return(nPlaceHolder);
        }
        ///
        ///          <summary> * (20) get JDFNumberList attribute StaggerRows </summary>
        ///          * <returns> JDFNumberList the value of the attribute, null if a the
        ///          *         attribute value is not a valid to create a JDFNumberList </returns>
        ///
        public virtual JDFNumberList getStaggerRows()
        {
            string        strAttrName  = "";
            JDFNumberList nPlaceHolder = null;

            strAttrName = getAttribute(AttributeName.STAGGERROWS, null, JDFConstants.EMPTYSTRING);
            try
            {
                nPlaceHolder = new JDFNumberList(strAttrName);
            }
            catch (FormatException)
            {
                return(null);
            }
            return(nPlaceHolder);
        }
Exemple #9
0
        ///
        ///          <summary> * (20) get JDFNumberList attribute BlankDimensionsY </summary>
        ///          * <returns> JDFNumberList the value of the attribute, null if a the
        ///          *         attribute value is not a valid to create a JDFNumberList </returns>
        ///
        public virtual JDFNumberList getBlankDimensionsY()
        {
            string        strAttrName  = "";
            JDFNumberList nPlaceHolder = null;

            strAttrName = getAttribute(AttributeName.BLANKDIMENSIONSY, null, JDFConstants.EMPTYSTRING);
            try
            {
                nPlaceHolder = new JDFNumberList(strAttrName);
            }
            catch (FormatException)
            {
                return(null);
            }
            return(nPlaceHolder);
        }
Exemple #10
0
        ///
        ///          <summary> * (20) get JDFNumberList attribute ScreenRuling </summary>
        ///          * <returns> JDFNumberList the value of the attribute, null if a the
        ///          *         attribute value is not a valid to create a JDFNumberList </returns>
        ///
        public virtual JDFNumberList getScreenRuling()
        {
            string        strAttrName  = "";
            JDFNumberList nPlaceHolder = null;

            strAttrName = getAttribute(AttributeName.SCREENRULING, null, JDFConstants.EMPTYSTRING);
            try
            {
                nPlaceHolder = new JDFNumberList(strAttrName);
            }
            catch (FormatException)
            {
                return(null);
            }
            return(nPlaceHolder);
        }
Exemple #11
0
        public void testIsValid()
        {
            JDFNumberList numberList = new JDFNumberList("1 2 3");

            iState.setDefaultValue(numberList);
            iState.setCurrentValue(numberList);
            Assert.IsFalse(iState.isValid(EnumValidationLevel.Complete));
            iState.setListType(EnumListType.List);
            Assert.IsTrue(iState.isValid(EnumValidationLevel.Complete));
            JDFNumberRangeList numberRList = new JDFNumberRangeList("1 2 3 4 ~ 44");

            iState.setAllowedValueList(numberRList);
            Assert.IsTrue(iState.isValid(EnumValidationLevel.Complete));
            JDFNumberRangeList numberList2 = new JDFNumberRangeList("1 2 3 7~77");

            iState.setPresentValueList(numberList2);
            Assert.IsTrue(iState.isValid(EnumValidationLevel.Complete));
        }
 //         ---------------------------------------------------------------------
 //        Methods for Attribute StaggerRows
 //        ---------------------------------------------------------------------
 ///
 ///          <summary> * (36) set attribute StaggerRows </summary>
 ///          * <param name="value">: the value to set the attribute to </param>
 ///
 public virtual void setStaggerRows(JDFNumberList @value)
 {
     setAttribute(AttributeName.STAGGERROWS, @value, null);
 }
 //         ---------------------------------------------------------------------
 //        Methods for Attribute ThreadPositions
 //        ---------------------------------------------------------------------
 ///
 ///          <summary> * (36) set attribute ThreadPositions </summary>
 ///          * <param name="value">: the value to set the attribute to </param>
 ///
 public virtual void setThreadPositions(JDFNumberList @value)
 {
     setAttribute(AttributeName.THREADPOSITIONS, @value, null);
 }
Exemple #14
0
        // ************************************************************************
        // * Attribute getter / setter
        // * ************************************************************************
        //

        //         ---------------------------------------------------------------------
        //        Methods for Attribute ColorList
        //        ---------------------------------------------------------------------
        ///
        ///          <summary> * (36) set attribute ColorList </summary>
        ///          * <param name="value">: the value to set the attribute to </param>
        ///
        public virtual void setColorList(JDFNumberList @value)
        {
            setAttribute(AttributeName.COLORLIST, @value, null);
        }
 //         ---------------------------------------------------------------------
 //        Methods for Attribute StaggerColumns
 //        ---------------------------------------------------------------------
 ///
 ///          <summary> * (36) set attribute StaggerColumns </summary>
 ///          * <param name="value">: the value to set the attribute to </param>
 ///
 public virtual void setStaggerColumns(JDFNumberList @value)
 {
     setAttribute(AttributeName.STAGGERCOLUMNS, @value, null);
 }
Exemple #16
0
        public static bool validStringForType(string val, EnumAttributeType iType, ValuedEnum enu)
        {
            if (val == null)
            {
                return(false);
            }

            try
            {
                if (iType == AttributeInfo.EnumAttributeType.Any)
                {
                    return(true);
                }
                if (iType == AttributeInfo.EnumAttributeType.string_)
                {
                    return(val.Length < 1024);
                }
                if (iType == AttributeInfo.EnumAttributeType.shortString)
                {
                    return(val.Length < 64);
                }
                if (iType == AttributeInfo.EnumAttributeType.ID)
                {
                    return(StringUtil.isID(val));
                }
                if (iType == AttributeInfo.EnumAttributeType.NMTOKEN)
                {
                    return(StringUtil.isNMTOKEN(val));
                }
                if (iType == AttributeInfo.EnumAttributeType.NMTOKENS)
                {
                    return(StringUtil.isNMTOKENS(val, false));
                }
                if (iType == AttributeInfo.EnumAttributeType.IDREF)
                {
                    return(StringUtil.isID(val));
                }
                if (iType == AttributeInfo.EnumAttributeType.IDREFS)
                {
                    return(StringUtil.isNMTOKENS(val, true));
                }
                if (iType == AttributeInfo.EnumAttributeType.boolean_)
                {
                    return(StringUtil.isBoolean(val));
                }
                if (iType == AttributeInfo.EnumAttributeType.double_)
                {
                    return(StringUtil.isNumber(val));
                }
                if (iType == AttributeInfo.EnumAttributeType.integer)
                {
                    return(StringUtil.isInteger(val));
                }
                // integer or unbounded
                if (iType == AttributeInfo.EnumAttributeType.unbounded)
                {
                    return(JDFConstants.UNBOUNDED.Equals(val) || StringUtil.isInteger(val));
                }

                if ((iType == AttributeInfo.EnumAttributeType.URI) || (iType == AttributeInfo.EnumAttributeType.URL))
                {
                    return(UrlUtil.isIRL(val));
                }
                else if (iType == AttributeInfo.EnumAttributeType.RegExp)
                {
                    return(true);
                }

                else if ((iType == AttributeInfo.EnumAttributeType.enumeration) || (iType == AttributeInfo.EnumAttributeType.JDFJMFVersion))
                {
                    if (enu != null)
                    {
                        ValuedEnum ve = (ValuedEnum)EnumUtils.getEnum(enu.GetType(), val);
                        return(ve != null);
                    }
                    // limp along if something went wrong
                    return(StringUtil.isNMTOKEN(val));
                }
                else if (iType == AttributeInfo.EnumAttributeType.enumerations)
                {
                    if (enu != null)
                    {
                        VString vs = new VString(StringUtil.tokenize(val, JDFConstants.BLANK, false));
                        for (int i = 0; i < vs.Count; i++)
                        {
                            ValuedEnum ve = (ValuedEnum)EnumUtils.getEnum(enu.GetType(), vs.stringAt(i));
                            // there was an invalid token
                            if (ve == null)
                            {
                                return(false);
                            }
                        }
                        // all were ok
                        return(true);
                    }
                    // limp along if something went wrong
                    return(StringUtil.isNMTOKENS(val, false));
                }
                else if (iType == AttributeInfo.EnumAttributeType.IntegerRange)
                {
                    new JDFIntegerRange(val);
                    return(true);
                }
                else if (iType == AttributeInfo.EnumAttributeType.IntegerList)
                {
                    new JDFIntegerList(val);
                    return(true);
                }
                else if (iType == AttributeInfo.EnumAttributeType.IntegerRangeList)
                {
                    new JDFIntegerRangeList(val);
                    return(true);
                }
                else if (iType == AttributeInfo.EnumAttributeType.NumberRange)
                {
                    new JDFNumberRange(val);
                    return(true);
                }
                else if (iType == AttributeInfo.EnumAttributeType.NumberRangeList)
                {
                    new JDFNumberRangeList(val);
                    return(true);
                }
                else if (iType == AttributeInfo.EnumAttributeType.NumberList)
                {
                    new JDFNumberList(val);
                    return(true);
                }
                else if (iType == AttributeInfo.EnumAttributeType.matrix)
                {
                    new JDFMatrix(val);
                    return(true);
                }
                else if (iType == AttributeInfo.EnumAttributeType.rectangle)
                {
                    new JDFRectangle(val);
                    return(true);
                }
                else if (iType == AttributeInfo.EnumAttributeType.shape)
                {
                    new JDFShape(val);
                    return(true);
                }
                else if (iType == AttributeInfo.EnumAttributeType.XYPair)
                {
                    new JDFXYPair(val);
                    return(true);
                }
                else if (iType == AttributeInfo.EnumAttributeType.XYPairRange)
                {
                    new JDFXYPairRange(val);
                    return(true);
                }
                else if (iType == AttributeInfo.EnumAttributeType.XYPairRangeList)
                {
                    new JDFXYPairRangeList(val);
                    return(true);
                }
                else if (iType == AttributeInfo.EnumAttributeType.dateTime)
                {
                    new JDFDate(val);
                    return(val.IndexOf("T") == 10); // pure dates are not valid
                }
                else if (iType == AttributeInfo.EnumAttributeType.duration)
                {
                    new JDFDuration(val);
                    return(true);
                }
                else if (iType == AttributeInfo.EnumAttributeType.DurationRangeList)
                {
                    new JDFDurationRangeList(val);
                    return(true);
                }
                else if (iType == AttributeInfo.EnumAttributeType.DateTimeRangeList)
                {
                    new JDFDateTimeRangeList(val);
                    return(true);
                }
                else if (iType == AttributeInfo.EnumAttributeType.RectangleRangeList)
                {
                    new JDFRectangleRangeList(val);
                    return(true);
                }
                else if (iType == AttributeInfo.EnumAttributeType.ShapeRangeList)
                {
                    new JDFShapeRangeList(val);
                    return(true);
                }
                else if (iType == AttributeInfo.EnumAttributeType.CMYKColor)
                {
                    new JDFCMYKColor(val);
                    return(true);
                }
                else if (iType == AttributeInfo.EnumAttributeType.LabColor)
                {
                    new JDFLabColor(val);
                    return(true);
                }
                else if (iType == AttributeInfo.EnumAttributeType.RGBColor)
                {
                    new JDFRGBColor(val);
                    return(true);
                }
                else if (iType == AttributeInfo.EnumAttributeType.language)
                {
                    return(validLanguageString(val));
                }
                else if (iType == AttributeInfo.EnumAttributeType.languages)
                {
                    VString v = new VString(StringUtil.tokenize(val, JDFConstants.BLANK, false));
                    for (int i = 0; i < v.Count; i++)
                    {
                        if (!validLanguageString(v[i]))
                        {
                            return(false);
                        }
                    }
                    return(true);
                }
                else if (iType == AttributeInfo.EnumAttributeType.PDFPath)
                {
                    // TODO better regexp
                    return(true);
                }
                else if (iType == AttributeInfo.EnumAttributeType.XPath)
                {
                    // TODO better regexp
                    return(true);
                }
                else if (iType == AttributeInfo.EnumAttributeType.hexBinary)
                {
                    return(StringUtil.matches(val, JDFConstants.REGEXP_HEXBINARY));
                }
                else if (iType == AttributeInfo.EnumAttributeType.TransferFunction)
                {
                    JDFNumberList nl = new JDFNumberList(val);
                    return(nl.Count % 2 == 0);
                }
                else
                {
                    // TODO check if we are complete
                    Console.WriteLine("validStringForType: unknown type:" + iType.getName());
                    return(false);
                }
            }
            catch (FormatException)
            {
                return(false);
            }
        }
 //         ---------------------------------------------------------------------
 //        Methods for Attribute WorkingList
 //        ---------------------------------------------------------------------
 ///
 ///          <summary> * (36) set attribute WorkingList </summary>
 ///          * <param name="value">: the value to set the attribute to </param>
 ///
 public virtual void setWorkingList(JDFNumberList @value)
 {
     setAttribute(AttributeName.WORKINGLIST, @value, null);
 }
 //         ---------------------------------------------------------------------
 //        Methods for Attribute StitchPositions
 //        ---------------------------------------------------------------------
 ///
 ///          <summary> * (36) set attribute StitchPositions </summary>
 ///          * <param name="value">: the value to set the attribute to </param>
 ///
 public virtual void setStitchPositions(JDFNumberList @value)
 {
     setAttribute(AttributeName.STITCHPOSITIONS, @value, null);
 }
Exemple #19
0
 //         ---------------------------------------------------------------------
 //        Methods for Attribute YPosition
 //        ---------------------------------------------------------------------
 ///
 ///          <summary> * (36) set attribute YPosition </summary>
 ///          * <param name="value">: the value to set the attribute to </param>
 ///
 public virtual void setYPosition(JDFNumberList @value)
 {
     setAttribute(AttributeName.YPOSITION, @value, null);
 }
Exemple #20
0
 //         ---------------------------------------------------------------------
 //        Methods for Attribute Density
 //        ---------------------------------------------------------------------
 ///
 ///          <summary> * (36) set attribute Density </summary>
 ///          * <param name="value">: the value to set the attribute to </param>
 ///
 public virtual void setDensity(JDFNumberList @value)
 {
     setAttribute(AttributeName.DENSITY, @value, null);
 }
        // ************************************************************************
        // * Attribute getter / setter
        // * ************************************************************************
        //

        //         ---------------------------------------------------------------------
        //        Methods for Attribute FountainPositions
        //        ---------------------------------------------------------------------
        ///
        ///          <summary> * (36) set attribute FountainPositions </summary>
        ///          * <param name="value">: the value to set the attribute to </param>
        ///
        public virtual void setFountainPositions(JDFNumberList @value)
        {
            setAttribute(AttributeName.FOUNTAINPOSITIONS, @value, null);
        }
Exemple #22
0
 //         ---------------------------------------------------------------------
 //        Methods for Attribute QuantTable
 //        ---------------------------------------------------------------------
 ///
 ///          <summary> * (36) set attribute QuantTable </summary>
 ///          * <param name="value">: the value to set the attribute to </param>
 ///
 public virtual void setQuantTable(JDFNumberList @value)
 {
     setAttribute(AttributeName.QUANTTABLE, @value, null);
 }
Exemple #23
0
 public virtual void setDefaultValue(JDFNumberList @value)
 {
     setAttribute(AttributeName.DEFAULTVALUE, @value, null);
 }
 //         ---------------------------------------------------------------------
 //        Methods for Attribute GapList
 //        ---------------------------------------------------------------------
 ///
 ///          <summary> * (36) set attribute GapList </summary>
 ///          * <param name="value">: the value to set the attribute to </param>
 ///
 public virtual void setGapList(JDFNumberList @value)
 {
     setAttribute(AttributeName.GAPLIST, @value, null);
 }
      // ************************************************************************
      // * Attribute getter / setter
      // * ************************************************************************
      // 

      //         ---------------------------------------------------------------------
      //        Methods for Attribute DividePositions
      //        --------------------------------------------------------------------- 
      ///        
      ///          <summary> * (36) set attribute DividePositions </summary>
      ///          * <param name="value">: the value to set the attribute to </param>
      ///          
      public virtual void setDividePositions(JDFNumberList @value)
      {
         setAttribute(AttributeName.DIVIDEPOSITIONS, @value, null);
      }
 //         ---------------------------------------------------------------------
 //        Methods for Attribute ZoneSettingsY
 //        ---------------------------------------------------------------------
 ///
 ///          <summary> * (36) set attribute ZoneSettingsY </summary>
 ///          * <param name="value">: the value to set the attribute to </param>
 ///
 public virtual void setZoneSettingsY(JDFNumberList @value)
 {
     setAttribute(AttributeName.ZONESETTINGSY, @value, null);
 }
Exemple #27
0
 //         ---------------------------------------------------------------------
 //        Methods for Attribute NeedlePositions
 //        ---------------------------------------------------------------------
 ///
 ///          <summary> * (36) set attribute NeedlePositions </summary>
 ///          * <param name="value">: the value to set the attribute to </param>
 ///
 public virtual void setNeedlePositions(JDFNumberList @value)
 {
     setAttribute(AttributeName.NEEDLEPOSITIONS, @value, null);
 }
Exemple #28
0
 //         ---------------------------------------------------------------------
 //        Methods for Attribute HuffTable
 //        ---------------------------------------------------------------------
 ///
 ///          <summary> * (36) set attribute HuffTable </summary>
 ///          * <param name="value">: the value to set the attribute to </param>
 ///
 public virtual void setHuffTable(JDFNumberList @value)
 {
     setAttribute(AttributeName.HUFFTABLE, @value, null);
 }
Exemple #29
0
 public virtual void setCurrentValue(JDFNumberList @value)
 {
     setAttribute(AttributeName.CURRENTVALUE, @value, null);
 }
Exemple #30
0
 //         ---------------------------------------------------------------------
 //        Methods for Attribute NumberValue
 //        ---------------------------------------------------------------------
 ///
 ///          <summary> * (36) set attribute NumberValue </summary>
 ///          * <param name="value">: the value to set the attribute to </param>
 ///
 public virtual void setNumberValue(JDFNumberList @value)
 {
     setAttribute(AttributeName.NUMBERVALUE, @value, null);
 }