/// <summary>
        /// Erzeugt die Binärrepräsentationen dieser Tabelle.
        /// </summary>
        /// <returns>Die gewünschte Repräsentation.</returns>
        public TableCreator CreateBinary()
        {
            // Create new
            TableCreator creator = new TableCreator();

            // Process all
            foreach (HuffmanTable table in Tables)
            {
                // Get the raw code
                char from = (HuffmanItem.StartOrEnd == table.Source[0]) ? '\0' : table.Source[0];

                // Process all
                foreach (HuffmanItem item in table.Items)
                {
                    // Get the raw code
                    char to = (HuffmanItem.StartOrEnd == item.Target[0]) ? '\0' : ((HuffmanItem.PassThrough == item.Target[0]) ? char.MaxValue : item.Target[0]);

                    // Register all
                    foreach (string sequence in item.AllSequences)
                    {
                        creator.AddTransition(from, to, HuffmanItem.GetSequencePattern(sequence), item.Sequence.Length);
                    }
                }
            }

            // Report
            return(creator);
        }
Example #2
0
        /// <summary>
        /// Erzeugt die Binärrepräsentationen dieser Tabelle.
        /// </summary>
        /// <returns>Die gewünschte Repräsentation.</returns>
        public TableCreator CreateBinary()
        {
            // Create new
            TableCreator creator = new TableCreator();

            // Process all
            foreach (HuffmanTable table in Tables)
            {
                // Get the raw code
                char from = (HuffmanItem.StartOrEnd == table.Source[0]) ? '\0' : table.Source[0];

                // Process all
                foreach (HuffmanItem item in table.Items)
                {
                    // Get the raw code
                    char to = (HuffmanItem.StartOrEnd == item.Target[0]) ? '\0' : ((HuffmanItem.PassThrough == item.Target[0]) ? char.MaxValue : item.Target[0]);

                    // Register all
                    foreach (string sequence in item.AllSequences)
                        creator.AddTransition( from, to, HuffmanItem.GetSequencePattern( sequence ), item.Sequence.Length );
                }
            }

            // Report
            return creator;
        }