Ejemplo n.º 1
0
 public RuleSet(int index, RuleID id)
 {
     mIndex = index;
     mID = id;
 }
        /// <summary> Returns a string in a format suitable for directly adding to a
        /// directory, as a value of the particular schema element class.
        ///
        /// </summary>
        /// <returns> A string representation of the class' definition.
        /// </returns>
        protected internal override string formatString()
        {
            System.Text.StringBuilder valueBuffer = new System.Text.StringBuilder("( ");
            string token;

            string[] strArray;

            token = RuleID.ToString();
            valueBuffer.Append(token);

            strArray = Names;
            if (strArray != null)
            {
                valueBuffer.Append(" NAME ");
                if (strArray.Length == 1)
                {
                    valueBuffer.Append("'" + strArray[0] + "'");
                }
                else
                {
                    valueBuffer.Append("( ");

                    for (int i = 0; i < strArray.Length; i++)
                    {
                        valueBuffer.Append(" '" + strArray[i] + "'");
                    }
                    valueBuffer.Append(" )");
                }
            }
            if ((object)(token = Description) != null)
            {
                valueBuffer.Append(" DESC ");
                valueBuffer.Append("'" + token + "'");
            }
            if (Obsolete)
            {
                valueBuffer.Append(" OBSOLETE");
            }
            if ((object)(token = NameForm) != null)
            {
                valueBuffer.Append(" FORM ");
                valueBuffer.Append("'" + token + "'");
            }
            if ((strArray = Superiors) != null)
            {
                valueBuffer.Append(" SUP ");
                if (strArray.Length > 1)
                {
                    valueBuffer.Append("( ");
                }
                for (int i = 0; i < strArray.Length; i++)
                {
                    if (i > 0)
                    {
                        valueBuffer.Append(" ");
                    }
                    valueBuffer.Append(strArray[i]);
                }
                if (strArray.Length > 1)
                {
                    valueBuffer.Append(" )");
                }
            }

            System.Collections.IEnumerator en;
            if ((en = QualifierNames) != null)
            {
                string   qualName;
                string[] qualValue;
                while (en.MoveNext())
                {
                    qualName = ((string)en.Current);
                    valueBuffer.Append(" " + qualName + " ");
                    if ((qualValue = getQualifier(qualName)) != null)
                    {
                        if (qualValue.Length > 1)
                        {
                            valueBuffer.Append("( ");
                        }
                        for (int i = 0; i < qualValue.Length; i++)
                        {
                            if (i > 0)
                            {
                                valueBuffer.Append(" ");
                            }
                            valueBuffer.Append("'" + qualValue[i] + "'");
                        }
                        if (qualValue.Length > 1)
                        {
                            valueBuffer.Append(" )");
                        }
                    }
                }
            }
            valueBuffer.Append(" )");
            return(valueBuffer.ToString());
        }
Ejemplo n.º 3
0
        public MLuat Luat()
        {
            CLuat cLuat = new CLuat();

            return(cLuat.GetByID(RuleID.ToString()));
        }