public AttributedString(AttributedCharacterIterator iterator, int start_0,
                         int end_1)
     : this(iterator, start_0, end_1, iterator.GetAllAttributeKeys())
 {
 }
        public AttributedString(AttributedCharacterIterator iterator)
        {
            if (iterator.GetBeginIndex() > iterator.GetEndIndex())
            {
                // text.0A=Invalid substring range
                throw new ArgumentException("text.0A"); //$NON-NLS-1$
            }
            StringBuilder buffer = new StringBuilder();

            for (int i = iterator.GetBeginIndex(); i < iterator.GetEndIndex(); i++)
            {
                buffer.Append(iterator.Current());
                iterator.Next();
            }
            text = buffer.ToString();
            ILOG.J2CsMapping.Collections.Generics.ISet <AttributedCharacterIterator_Constants.Attribute> attributes = iterator
                                                                                                                      .GetAllAttributeKeys();
            if (attributes == null)
            {
                return;
            }
            attributeMap = new Dictionary <AttributedCharacterIterator_Constants.Attribute, IList <Range> >(
                (attributes.Count * 4 / 3) + 1);

            IIterator <AttributedCharacterIterator_Constants.Attribute> it = new ILOG.J2CsMapping.Collections.Generics.IteratorAdapter <ILOG.J2CsMapping.Text.AttributedCharacterIterator_Constants.Attribute>(attributes.GetEnumerator());

            while (it.HasNext())
            {
                AttributedCharacterIterator_Constants.Attribute attribute = it.Next();
                iterator.SetIndex(0);
                while (iterator.Current() != ILOG.J2CsMapping.Text.CharacterIterator.Done)
                {
                    int    start_0   = iterator.GetRunStart(attribute);
                    int    limit     = iterator.GetRunLimit(attribute);
                    Object value_ren = iterator.GetAttribute(attribute);
                    if (value_ren != null)
                    {
                        AddAttribute(attribute, value_ren, start_0, limit);
                    }
                    iterator.SetIndex(limit);
                }
            }
        }