test_class.declarator: executorService
test_class.modifier: private
test_class.original_string: private ExecutorService executorService;
test_class.type: ExecutorService
test_class.var_name: executorService
test_class.file: rosjava/nrosjava/src/test/java/org/ros/concurrent/CircularBlockingDequeTest.java
test_class.identifier: CircularBlockingDequeTest
test_case.body: @Test
    public void testIterator() throws InterruptedException {
      // We keep the queue short and throw in an unused element so that the deque
      // wraps around the backing array.
      CircularBlockingDeque<String> deque = new CircularBlockingDeque<String>(2);
      deque.addLast("unused");
      String expectedString1 = "Hello, world!";
      String expectedString2 = "Goodbye, world!";
      deque.addLast(expectedString1);
      deque.addLast(expectedString2);
      Iterator<String> iterator = deque.iterator();
      assertEquals(expectedString1, iterator.next());
      assertEquals(expectedString2, iterator.next());
      assertFalse(iterator.hasNext());
      try {
        iterator.next();
        fail();
      } catch (NoSuchElementException e) {
        // next() should throw an exception if there is no next element.
      }
      deque.takeFirst();
      iterator = deque.iterator();
      assertEquals(expectedString2, iterator.next());
      assertFalse(iterator.hasNext());
    }
test_case.class_method_signature: CircularBlockingDequeTest.testIterator()
test_case.full_signature: @Test public void testIterator()
test_case.identifier: testIterator
test_case.invocations: addLast addLast addLast iterator assertEquals next assertEquals next assertFalse hasNext next fail takeFirst iterator assertEquals next assertFalse hasNext
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testIterator()
focal_class.declarator: deque
focal_class.modifier: private final
focal_class.original_string: private final T[] deque;
focal_class.type: T[]
focal_class.var_name: deque
focal_class.declarator: mutex
focal_class.modifier: private final
focal_class.original_string: private final Object mutex;
focal_class.type: Object
focal_class.var_name: mutex
focal_class.declarator: limit
focal_class.modifier: private final
focal_class.original_string: private final int limit;
focal_class.type: int
focal_class.var_name: limit
focal_class.declarator: start
focal_class.modifier: private
focal_class.original_string: private int start;
focal_class.type: int
focal_class.var_name: start
focal_class.declarator: length
focal_class.modifier: private
focal_class.original_string: private int length;
focal_class.type: int
focal_class.var_name: length
focal_class.file: rosjava/nrosjava/src/main/java/org/ros/concurrent/CircularBlockingDeque.java
focal_class.identifier: CircularBlockingDeque
focal_class.interfaces: implements Iterable<T>
focal_class.class_method_signature: CircularBlockingDeque.CircularBlockingDeque(int capacity)
focal_class.full_signature: @SuppressWarnings("unchecked") public  CircularBlockingDeque(int capacity)
focal_class.identifier: CircularBlockingDeque
focal_class.modifiers: @SuppressWarnings("unchecked") public
focal_class.parameters: (int capacity)
focal_class.signature:  CircularBlockingDeque(int capacity)
focal_class.class_method_signature: CircularBlockingDeque.addLast(T entry)
focal_class.full_signature: public boolean addLast(T entry)
focal_class.identifier: addLast
focal_class.modifiers: public
focal_class.parameters: (T entry)
focal_class.return: boolean
focal_class.signature: boolean addLast(T entry)
focal_class.class_method_signature: CircularBlockingDeque.addFirst(T entry)
focal_class.full_signature: public boolean addFirst(T entry)
focal_class.identifier: addFirst
focal_class.modifiers: public
focal_class.parameters: (T entry)
focal_class.return: boolean
focal_class.signature: boolean addFirst(T entry)
focal_class.class_method_signature: CircularBlockingDeque.takeFirst()
focal_class.full_signature: public T takeFirst()
focal_class.identifier: takeFirst
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: T
focal_class.signature: T takeFirst()
focal_class.class_method_signature: CircularBlockingDeque.poll()
focal_class.full_signature: public T poll()
focal_class.identifier: poll
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: T
focal_class.signature: T poll()
focal_class.class_method_signature: CircularBlockingDeque.peekFirst()
focal_class.full_signature: public T peekFirst()
focal_class.identifier: peekFirst
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: T
focal_class.signature: T peekFirst()
focal_class.class_method_signature: CircularBlockingDeque.takeLast()
focal_class.full_signature: public T takeLast()
focal_class.identifier: takeLast
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: T
focal_class.signature: T takeLast()
focal_class.class_method_signature: CircularBlockingDeque.peekLast()
focal_class.full_signature: public T peekLast()
focal_class.identifier: peekLast
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: T
focal_class.signature: T peekLast()
focal_class.class_method_signature: CircularBlockingDeque.isEmpty()
focal_class.full_signature: public boolean isEmpty()
focal_class.identifier: isEmpty
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: boolean
focal_class.signature: boolean isEmpty()
focal_class.class_method_signature: CircularBlockingDeque.iterator()
focal_class.full_signature: @Override public Iterator<T> iterator()
focal_class.identifier: iterator
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: Iterator<T>
focal_class.signature: Iterator<T> iterator()
focal_method.body: @Override
    public Iterator<T> iterator() {
      return new Iterator<T>() {
        int offset = 0;
  
        @Override
        public boolean hasNext() {
          return offset < length;
        }
  
        @Override
        public T next() {
          if (offset == length) {
            throw new NoSuchElementException();
          }
          T entry = deque[(start + offset) % limit];
          offset++;
          return entry;
        }
  
        @Override
        public void remove() {
          throw new UnsupportedOperationException();
        }
      };
    }
focal_method.class_method_signature: CircularBlockingDeque.iterator()
focal_method.full_signature: @Override public Iterator<T> iterator()
focal_method.identifier: iterator
focal_method.modifiers: @Override public
focal_method.parameters: ()
focal_method.return: Iterator<T>
focal_method.signature: Iterator<T> iterator()