Exemple #1
0
 public virtual void setUp()
 {
     JDFElement.uniqueID(1);
     JDFIntegerRange.setDefaultDef(0);
     agentName    = JDFAudit.getStaticAgentName();
     agentVersion = JDFAudit.getStaticAgentVersion();
     author       = JDFAudit.getStaticAuthor();
     mem          = getCurrentMem();
 }
Exemple #2
0
        ///
        ///	 <summary> * fitsValueList - checks whether <code>rangelist</code> matches the
        ///	 * AllowedValueList/PresentValueList, specified for this State
        ///	 *  </summary>
        ///	 * <param name="rangelist">
        ///	 *            range list to test </param>
        ///	 * <param name="valuelist">
        ///	 *            switches between AllowedValueList and PresentValueList
        ///	 *  </param>
        ///	 * <returns> boolean - true, if <code>rangelist</code> matches the valuelist
        ///	 *         or if AllowedValueList is not specified </returns>
        ///
        private bool fitsValueList(JDFIntegerRangeList rangelist, EnumFitsValue valuelist)
        {
            JDFIntegerRangeList list = null;

            if (valuelist.Equals(EnumFitsValue.Allowed))
            {
                list = getAllowedValueList();
            }
            else
            {
                list = getPresentValueList();
            }
            if (list == null)
            {
                return(true);
            }

            EnumListType listType = getListType();

            if (listType.Equals(EnumListType.CompleteList))
            {
                return(fitsCompleteList(rangelist, list));
            }
            else if (listType.Equals(EnumListType.CompleteOrderedList))
            {
                return(fitsCompleteOrderedList(rangelist, list));
            }
            else if (listType.Equals(EnumListType.ContainedList))
            {
                return(fitsContainedList(rangelist, list));
            }

            int siz = rangelist.Count;

            for (int i = 0; i < siz; i++)
            {
                JDFIntegerRange range = (JDFIntegerRange)rangelist[i];

                // if range looks like"0~-1" but no xdef, then we assume that
                // xdef=lastIntegerInList
                int lastInList   = ((JDFIntegerRange)list[list.Count - 1]).Right;
                int leftInRange  = range.Left;
                int rightInRange = range.Right;
                if (lastInList > 0 && ((rightInRange < 0 && Math.Abs(rightInRange) < lastInList) || (leftInRange < 0 && Math.Abs(leftInRange) < lastInList)))
                {
                    range.setDef(lastInList);
                }
                if (!list.isPartOfRange(range))
                {
                    return(false);
                }
            }
            return(true);
        }
Exemple #3
0
 public virtual JDFIntegerRange getPresentLength()
 {
     if (hasAttribute(AttributeName.PRESENTLENGTH))
     {
         try
         {
             JDFIntegerRange ir = new JDFIntegerRange(getAttribute(AttributeName.PRESENTLENGTH));
             return(ir);
         }
         catch (FormatException)
         {
             throw new JDFException("JDFAbstractState.getPresentLength: Attribute PRESENTLENGTH is not capable to create JDFIntegerRange");
         }
     }
     return(getAllowedLength());
 }
        ///
        ///          <summary> * (20) get JDFIntegerRange attribute LengthJDF </summary>
        ///          * <returns> JDFIntegerRange the value of the attribute, null if a the
        ///          *         attribute value is not a valid to create a JDFIntegerRange </returns>
        ///
        public virtual JDFIntegerRange getLengthJDF()
        {
            string          strAttrName  = "";
            JDFIntegerRange nPlaceHolder = null;

            strAttrName = getAttribute(AttributeName.LENGTHJDF, null, JDFConstants.EMPTYSTRING);
            try
            {
                nPlaceHolder = new JDFIntegerRange(strAttrName);
            }
            catch (FormatException)
            {
                return(null);
            }
            return(nPlaceHolder);
        }
Exemple #5
0
 ///
 ///	 <summary> * get attribute AllowedLength
 ///	 *  </summary>
 ///	 * <returns> JDFIntegerRange: the attribute value </returns>
 ///
 public virtual JDFIntegerRange getAllowedLength()
 {
     try
     {
         string len = getAttribute(AttributeName.ALLOWEDLENGTH, null, null);
         if (len == null)
         {
             return(null);
         }
         JDFIntegerRange ir = new JDFIntegerRange(len);
         return(ir);
     }
     catch (FormatException)
     {
         throw new JDFException("JDFAbstractState.getAllowedLength: Attribute ALLOWEDLENGTH is not capable to create JDFIntegerRange");
     }
 }
Exemple #6
0
 public override void setPresentLength(JDFIntegerRange @value)
 {
     base.setAllowedLength(@value);
 }
Exemple #7
0
        //
        //	 * // Attribute getter/ setter
        //

        public virtual void setLength(JDFIntegerRange @value)
        {
            setAttribute(AttributeName.LENGTH, @value.ToString());
        }
        // ************************************************************************
        // * Attribute getter / setter
        // * ************************************************************************
        //

        //         ---------------------------------------------------------------------
        //        Methods for Attribute LengthJDF
        //        ---------------------------------------------------------------------
        ///
        ///          <summary> * (36) set attribute LengthJDF </summary>
        ///          * <param name="value">: the value to set the attribute to </param>
        ///
        public virtual void setLengthJDF(JDFIntegerRange @value)
        {
            setAttribute(AttributeName.LENGTHJDF, @value, null);
        }