Esempio n. 1
0
 public bool InRange(AttributedString.Range range)
 {
     if (!(range.value_ren is ILOG.J2CsMapping.Util.Annotation))
     {
         return(true);
     }
     return(range.start >= begin && range.start < end &&
            range.end > begin && range.end <= end);
 }
Esempio n. 2
0
            public Object CurrentValue(IList <Range> ranges)
            {
                IIterator <Range> it = new ILOG.J2CsMapping.Collections.Generics.IteratorAdapter <ILOG.J2CsMapping.Text.AttributedString.Range>(ranges.GetEnumerator());

                while (it.HasNext())
                {
                    AttributedString.Range range = it.Next();
                    if (offset >= range.start && offset < range.end)
                    {
                        return((InRange(range)) ? range.value_ren : null);
                    }
                }
                return(null);
            }
Esempio n. 3
0
            public bool InRange(IList <Range> ranges)
            {
                IIterator <Range> it = new ILOG.J2CsMapping.Collections.Generics.IteratorAdapter <ILOG.J2CsMapping.Text.AttributedString.Range>(ranges.GetEnumerator());

                while (it.HasNext())
                {
                    AttributedString.Range range = it.Next();
                    if (range.start >= begin && range.start < end)
                    {
                        return(!(range.value_ren is ILOG.J2CsMapping.Util.Annotation) ||
                               (range.end > begin && range.end <= end));
                    }
                    else if (range.end > begin && range.end <= end)
                    {
                        return(!(range.value_ren is ILOG.J2CsMapping.Util.Annotation) ||
                               (range.start >= begin && range.start < end));
                    }
                }
                return(false);
            }
Esempio n. 4
0
            public int RunStart(IList <Range> ranges)
            {
                int result           = begin;
                IIterator <Range> it = new ILOG.J2CsMapping.Collections.Generics.IteratorAdapter <ILOG.J2CsMapping.Text.AttributedString.Range>(ranges.GetEnumerator());

                while (it.HasNext())
                {
                    AttributedString.Range range = it.Next();
                    if (range.start >= end)
                    {
                        break;
                    }
                    if (offset >= range.start && offset < range.end)
                    {
                        return((InRange(range)) ? range.start : result);
                    }
                    else if (offset < range.start)
                    {
                        break;
                    }
                    result = range.end;
                }
                return(result);
            }
Esempio n. 5
0
            public int RunLimit(IList <Range> ranges)
            {
                int result = end;
                IListIterator <Range> it = new ILOG.J2CsMapping.Collections.Generics.ArrayListIterator <ILOG.J2CsMapping.Text.AttributedString.Range>(ranges, ranges.Count);

                while (it.HasPrevious())
                {
                    AttributedString.Range range = it.Previous();
                    if (range.end <= begin)
                    {
                        break;
                    }
                    if (offset >= range.start && offset < range.end)
                    {
                        return((InRange(range)) ? range.end : result);
                    }
                    else if (offset >= range.end)
                    {
                        break;
                    }
                    result = range.start;
                }
                return(result);
            }
Esempio n. 6
0
        public void AddAttribute(AttributedCharacterIterator_Constants.Attribute attribute,
                                 Object value_ren, int start_0, int end_1)
        {
            if (null == attribute)
            {
                throw new NullReferenceException();
            }
            if (start_0 < 0 || end_1 > text.Length || start_0 >= end_1)
            {
                throw new ArgumentException();
            }

            if (value_ren == null)
            {
                return;
            }

            IList <Range> ranges = ((System.Collections.Generic.IList <ILOG.J2CsMapping.Text.AttributedString.Range>)ILOG.J2CsMapping.Collections.Generics.Collections.Get(attributeMap, attribute));

            if (ranges == null)
            {
                ranges = new List <Range>(1);
                ILOG.J2CsMapping.Collections.Generics.Collections.Add(ranges, new AttributedString.Range(start_0, end_1, value_ren));
                ILOG.J2CsMapping.Collections.Generics.Collections.Put(attributeMap, (ILOG.J2CsMapping.Text.AttributedCharacterIterator_Constants.Attribute)(attribute), (System.Collections.Generic.IList <ILOG.J2CsMapping.Text.AttributedString.Range>)(ranges));
                return;
            }
            IListIterator <Range> it = new ArrayListIterator <Range>(ranges);

            while (it.HasNext())
            {
                // foreach(Range range in ranges) {
                AttributedString.Range range = it.Next();
                if (end_1 <= range.start)
                {
                    it.Previous();
                    break;
                }
                else if (start_0 < range.end ||
                         (start_0 == range.end && value_ren.Equals(range.value_ren)))
                {
                    AttributedString.Range r1 = null, r3;
                    it.Remove();
                    r1 = new AttributedString.Range(range.start, start_0, range.value_ren);
                    r3 = new AttributedString.Range(end_1, range.end, range.value_ren);

                    while (end_1 > range.end && it.HasNext())
                    {
                        range = it.Next();
                        if (end_1 <= range.end)
                        {
                            if (end_1 > range.start ||
                                (end_1 == range.start && value_ren
                                 .Equals(range.value_ren)))
                            {
                                it.Remove();
                                r3 = new AttributedString.Range(end_1, range.end, range.value_ren);
                                break;
                            }
                        }
                        else
                        {
                            it.Remove();
                        }
                    }

                    if (value_ren.Equals(r1.value_ren))
                    {
                        if (value_ren.Equals(r3.value_ren))
                        {
                            it.Add(new AttributedString.Range((r1.start < start_0) ? r1.start : start_0,
                                                              (r3.end > end_1) ? r3.end : end_1, r1.value_ren));
                        }
                        else
                        {
                            it.Add(new AttributedString.Range((r1.start < start_0) ? r1.start : start_0,
                                                              end_1, r1.value_ren));
                            if (r3.start < r3.end)
                            {
                                it.Add(r3);
                            }
                        }
                    }
                    else
                    {
                        if (value_ren.Equals(r3.value_ren))
                        {
                            if (r1.start < r1.end)
                            {
                                it.Add(r1);
                            }
                            it.Add(new AttributedString.Range(start_0, (r3.end > end_1) ? r3.end : end_1,
                                                              r3.value_ren));
                        }
                        else
                        {
                            if (r1.start < r1.end)
                            {
                                it.Add(r1);
                            }
                            it.Add(new AttributedString.Range(start_0, end_1, value_ren));
                            if (r3.start < r3.end)
                            {
                                it.Add(r3);
                            }
                        }
                    }
                    return;
                }
            }
            it.Add(new AttributedString.Range(start_0, end_1, value_ren));
        }