test_class.file: runtime/master/interactivespaces-master/src/test/java/interactivespaces/master/server/services/internal/SpaceWalkerTest.java
test_class.identifier: SpaceWalkerTest
test_class.superclass: extends BaseSpaceTest
test_case.body: @Test
    public void testWalk() {
      Space spaceTree =
          space(0).addSpaces(space(1).addSpaces(space(4), space(5)), space(2).addSpaces(space(6)),
              space(3).addSpaces(space(7), space(8), space(9)));
  
      List<String> expectedWalkSequence = getIdList(0, 1, 2, 3, 4, 5, 6, 7, 8, 9);
  
      final List<String> idsInOrderWalked = new ArrayList<String>();
      final AtomicBoolean beginRan = new AtomicBoolean(false);
      final AtomicBoolean endRan = new AtomicBoolean(false);
      SpaceWalker walker = new SpaceWalker() {
  
        @Override
        protected void doBegin() {
          assertFalse(beginRan.get());
          assertFalse(endRan.get());
          assertTrue(idsInOrderWalked.isEmpty());
  
          beginRan.set(true);
        }
  
        @Override
        protected void doEnd() {
          assertTrue(beginRan.get());
          assertFalse(endRan.get());
          assertFalse(idsInOrderWalked.isEmpty());
  
          endRan.set(true);
        }
  
        @Override
        protected void doVisit(Space space) {
          assertTrue(beginRan.get());
          assertFalse(endRan.get());
  
          idsInOrderWalked.add(space.getName());
        }
  
      };
  
      walker.walk(spaceTree);
  
      assertTrue(beginRan.get());
      assertTrue(endRan.get());
      assertEquals(expectedWalkSequence, idsInOrderWalked);
    }
test_case.class_method_signature: SpaceWalkerTest.testWalk()
test_case.full_signature: @Test public void testWalk()
test_case.identifier: testWalk
test_case.invocations: addSpaces space addSpaces space space space addSpaces space space addSpaces space space space space getIdList assertFalse get assertFalse get assertTrue isEmpty set assertTrue get assertFalse get assertFalse isEmpty set assertTrue get assertFalse get add getName walk assertTrue get assertTrue get assertEquals
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testWalk()
focal_class.declarator: walkingQueue = new LinkedList<Space>()
focal_class.modifier: private
focal_class.original_string: private Queue<Space> walkingQueue = new LinkedList<Space>();
focal_class.type: Queue<Space>
focal_class.var_name: walkingQueue
focal_class.file: runtime/master/interactivespaces-master/src/main/java/interactivespaces/master/server/services/internal/SpaceWalker.java
focal_class.identifier: SpaceWalker
focal_class.class_method_signature: SpaceWalker.walk(Space space)
focal_class.full_signature: public void walk(Space space)
focal_class.identifier: walk
focal_class.modifiers: public
focal_class.parameters: (Space space)
focal_class.return: void
focal_class.signature: void walk(Space space)
focal_class.class_method_signature: SpaceWalker.doBegin()
focal_class.full_signature: protected void doBegin()
focal_class.identifier: doBegin
focal_class.modifiers: protected
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void doBegin()
focal_class.class_method_signature: SpaceWalker.doEnd()
focal_class.full_signature: protected void doEnd()
focal_class.identifier: doEnd
focal_class.modifiers: protected
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void doEnd()
focal_class.class_method_signature: SpaceWalker.doVisit(Space space)
focal_class.full_signature: protected abstract void doVisit(Space space)
focal_class.identifier: doVisit
focal_class.modifiers: protected abstract
focal_class.parameters: (Space space)
focal_class.return: void
focal_class.signature: void doVisit(Space space)
focal_method.body: public void walk(Space space) {
      doBegin();
  
      walkingQueue.offer(space);
      while (!walkingQueue.isEmpty()) {
        Space curSpace = walkingQueue.remove();
        walkingQueue.addAll(curSpace.getSpaces());
  
        doVisit(curSpace);
      }
  
      doEnd();
    }
focal_method.class_method_signature: SpaceWalker.walk(Space space)
focal_method.full_signature: public void walk(Space space)
focal_method.identifier: walk
focal_method.invocations: doBegin offer isEmpty remove addAll getSpaces doVisit doEnd
focal_method.modifiers: public
focal_method.parameters: (Space space)
focal_method.return: void
focal_method.signature: void walk(Space space)