Beispiel #1
0
        /// <summary>
        /// recovers current pattern. </summary>
        /// <param name="withWhiteSpace"> puts spacing around the entries, and \n
        /// before & and < </param>
        public String GetPattern(bool withWhiteSpace)
        {
            StringBuffer        result  = new StringBuffer();
            PatternEntry        tmp     = null;
            List <PatternEntry> extList = null;
            int i;

            for (i = 0; i < Patterns.Count; ++i)
            {
                PatternEntry entry = Patterns[i];
                if (entry.Extension_Renamed.length() != 0)
                {
                    if (extList == null)
                    {
                        extList = new List <>();
                    }
                    extList.Add(entry);
                }
                else
                {
                    if (extList != null)
                    {
                        PatternEntry last = FindLastWithNoExtension(i - 1);
                        for (int j = extList.Count - 1; j >= 0; j--)
                        {
                            tmp = extList[j];
                            tmp.AddToBuffer(result, false, withWhiteSpace, last);
                        }
                        extList = null;
                    }
                    entry.AddToBuffer(result, false, withWhiteSpace, null);
                }
            }
            if (extList != null)
            {
                PatternEntry last = FindLastWithNoExtension(i - 1);
                for (int j = extList.Count - 1; j >= 0; j--)
                {
                    tmp = extList[j];
                    tmp.AddToBuffer(result, false, withWhiteSpace, last);
                }
                extList = null;
            }
            return(result.ToString());
        }
Beispiel #2
0
        /// <summary>
        /// emits the pattern for collation builder. </summary>
        /// <param name="withWhiteSpace"> puts spacing around the entries, and \n
        /// before & and < </param>
        /// <returns> emits the string in the format understable to the collation
        /// builder. </returns>
        public String EmitPattern(bool withWhiteSpace)
        {
            StringBuffer result = new StringBuffer();

            for (int i = 0; i < Patterns.Count; ++i)
            {
                PatternEntry entry = Patterns[i];
                if (entry != null)
                {
                    entry.AddToBuffer(result, true, withWhiteSpace, null);
                }
            }
            return(result.ToString());
        }