/**
  * Removes the last returned element.
  *
  * @throws UnsupportedOperationException if the list is unmodifiable
  * @throws IllegalStateException if there is no element to remove
  */
 public void remove()
 {
     if (validForUpdate == false)
     {
         throw new java.lang.IllegalStateException("Cannot remove from list until next() or previous() called");
     }
     iterator.remove();
 }
 public virtual void remove()
 {
     if (readable == false)
     {
         throw new java.lang.IllegalStateException(AbstractHashedMap.REMOVE_INVALID);
     }
     iterator.remove();
     parent.map.remove(last);
     readable = false;
 }
Пример #3
0
 public override E remove(int location)
 {
     try
     {
         java.util.ListIterator <E> it = listIterator(location);
         E result = it.next();
         it.remove();
         return(result);
     }
     catch (java.util.NoSuchElementException)
     {
         throw new System.IndexOutOfRangeException();
     }
 }
Пример #4
0
        /**
         * Applies a given attribute to the given range of this string.
         *
         * @param attribute
         *            the attribute that will be applied to this string.
         * @param value
         *            the value of the attribute that will be applied to this
         *            string.
         * @param start
         *            the start of the range where the attribute will be applied.
         * @param end
         *            the end of the range where the attribute will be applied.
         * @throws IllegalArgumentException
         *             if {@code start < 0}, {@code end} is greater than the length
         *             of this string, or if {@code start >= end}.
         * @throws NullPointerException
         *             if {@code attribute} is {@code null}.
         */
        public void addAttribute(AttributedCharacterIteratorNS.Attribute attribute,
                                 System.Object value, int start, int end)
        {
            if (null == attribute)
            {
                throw new java.lang.NullPointerException();
            }
            if (start < 0 || end > text.Length || start >= end)
            {
                throw new java.lang.IllegalArgumentException();
            }

            if (value == null)
            {
                return;
            }

            java.util.List <IAC_Range> ranges = attributeMap.get(attribute);
            if (ranges == null)
            {
                ranges = new java.util.ArrayList <IAC_Range>(1);
                ranges.add(new IAC_Range(start, end, value));
                attributeMap.put(attribute, ranges);
                return;
            }
            java.util.ListIterator <IAC_Range> it = ranges.listIterator();
            while (it.hasNext())
            {
                IAC_Range range = it.next();
                if (end <= range.start)
                {
                    it.previous();
                    break;
                }
                else if (start < range.end ||
                         (start == range.end && value.Equals(range.value)))
                {
                    IAC_Range r1 = null, r3;
                    it.remove();
                    r1 = new IAC_Range(range.start, start, range.value);
                    r3 = new IAC_Range(end, range.end, range.value);

                    while (end > range.end && it.hasNext())
                    {
                        range = it.next();
                        if (end <= range.end)
                        {
                            if (end > range.start ||
                                (end == range.start && value.Equals(range.value)))
                            {
                                it.remove();
                                r3 = new IAC_Range(end, range.end, range.value);
                                break;
                            }
                        }
                        else
                        {
                            it.remove();
                        }
                    }

                    if (value.Equals(r1.value))
                    {
                        if (value.Equals(r3.value))
                        {
                            it.add(new IAC_Range(r1.start <start?r1.start : start,
                                                           r3.end> end ? r3.end : end, r1.value));
                        }
                        else
                        {
                            it.add(new IAC_Range(r1.start < start ? r1.start : start,
                                                 end, r1.value));
                            if (r3.start < r3.end)
                            {
                                it.add(r3);
                            }
                        }
                    }
                    else
                    {
                        if (value.Equals(r3.value))
                        {
                            if (r1.start < r1.end)
                            {
                                it.add(r1);
                            }
                            it.add(new IAC_Range(start, r3.end > end ? r3.end : end,
                                                 r3.value));
                        }
                        else
                        {
                            if (r1.start < r1.end)
                            {
                                it.add(r1);
                            }
                            it.add(new IAC_Range(start, end, value));
                            if (r3.start < r3.end)
                            {
                                it.add(r3);
                            }
                        }
                    }
                    return;
                }
            }
            it.add(new IAC_Range(start, end, value));
        }
Пример #5
0
 public void remove()
 {
     iterator.remove();
     subList.sizeChanged(false);
     end--;
 }
 public virtual void remove()
 {
     iterator.remove();
     parent.remove(last.getKey());
     last = null;
 }
Пример #7
0
 public virtual void remove()
 {
     iterator.remove();
 }
Пример #8
0
 /**
  * Removes the previously retrieved item from the underlying list.
  * <p>
  * This feature is only supported if the underlying list's
  * {@link List#iterator iterator} method returns an implementation
  * that supports it.
  * <p>
  * This method can only be called after at least one {@link #next}
  * or {@link #previous} method call. After a removal, the remove
  * method may not be called again until another {@link #next} or
  * {@link #previous} has been performed. If the {@link #reset} is
  * called, then remove may not be called until {@link #next} or
  * {@link #previous} is called again.
  *
  * @throws UnsupportedOperationException if the remove method is
  * not supported by the iterator implementation of the underlying
  * list
  */
 public void remove()
 {
     iterator.remove();
 }