Visit first index index node.

@param visitor the visitor
@return the index node
12857
public IndexNode visitFirstIndex(Consumer<? super IndexNode> visitor) {
    visitor.accept(this);
    IndexNode refresh = refresh();
    refresh.getChildren().forEach(n -> n.visitFirstIndex(visitor));
    return refresh;
  }
1274482
public <R,P> R accept(KindVisitor<R,P> visitor, P p) {
        switch (getKind()) {
            case NO_OPERANDS:
                return visitor.visitNoOperands(this, p);

            case ATYPE:
                return visitor.visitArrayType(
                        this, TypeKind.get(getUnsignedByte(1)), p);

            case BRANCH:
                return visitor.visitBranch(this, getShort(1), p);

            case BRANCH_W:
                return visitor.visitBranch(this, getInt(1), p);

            case BYTE:
                return visitor.visitValue(this, getByte(1), p);

            case CPREF:
                return visitor.visitConstantPoolRef(this, getUnsignedByte(1), p);

            case CPREF_W:
                return visitor.visitConstantPoolRef(this, getUnsignedShort(1), p);

            case CPREF_W_UBYTE:
            case CPREF_W_UBYTE_ZERO:
                return visitor.visitConstantPoolRefAndValue(
                        this, getUnsignedShort(1), getUnsignedByte(3), p);

            case DYNAMIC: {
                switch (getOpcode()) {
                    case TABLESWITCH: {
                        int pad = align(pc + 1) - pc;
                        int default_ = getInt(pad);
                        int low = getInt(pad + 4);
                        int high = getInt(pad + 8);
                        int[] values = new int[high - low + 1];
                        for (int i = 0; i < values.length; i++)
                            values[i] = getInt(pad + 12 + 4 * i);
                        return visitor.visitTableSwitch(
                                this, default_, low, high, values, p);
                    }
                    case LOOKUPSWITCH: {
                        int pad = align(pc + 1) - pc;
                        int default_ = getInt(pad);
                        int npairs = getInt(pad + 4);
                        int[] matches = new int[npairs];
                        int[] offsets = new int[npairs];
                        for (int i = 0; i < npairs; i++) {
                            matches[i] = getInt(pad +  8 + i * 8);
                            offsets[i] = getInt(pad + 12 + i * 8);
                        }
                        return visitor.visitLookupSwitch(
                                this, default_, npairs, matches, offsets, p);
                    }
                    default:
                        throw new IllegalStateException();
                }
            }

            case LOCAL:
                return visitor.visitLocal(this, getUnsignedByte(1), p);

            case LOCAL_BYTE:
                return visitor.visitLocalAndValue(
                        this, getUnsignedByte(1), getByte(2), p);

            case SHORT:
                return visitor.visitValue(this, getShort(1), p);

            case WIDE_NO_OPERANDS:
                return visitor.visitNoOperands(this, p);

            case WIDE_LOCAL:
                return visitor.visitLocal(this, getUnsignedShort(2), p);

            case WIDE_CPREF_W:
                return visitor.visitConstantPoolRef(this, getUnsignedShort(2), p);

            case WIDE_CPREF_W_SHORT:
                return visitor.visitConstantPoolRefAndValue(
                        this, getUnsignedShort(2), getUnsignedByte(4), p);

            case WIDE_LOCAL_SHORT:
                return visitor.visitLocalAndValue(
                        this, getUnsignedShort(2), getShort(4), p);

            case UNKNOWN:
                return visitor.visitUnknown(this, p);

            default:
                throw new IllegalStateException();
        }
    }
62282
public Object depthFirst(NodeVisitor nodeVisitor, Node root) {
        return depthFirst(nodeVisitor, Collections.singleton(root));
    }
362065
def get_visitor(self, node):
        
        method = 'visit_' + node.__class__.__name__
        return getattr(self, method, None)
718920
public int getFirstAttribute(int nodeHandle) {
                nodeHandle &= NODEHANDLE_MASK;

                // %REVIEW% jjk: Just a quick observation: If you're going to
                // call readEntry repeatedly on the same node, it may be
                // more efficiently to do a readSlot to get the data locally,
                // reducing the addressing and call-and-return overhead.

                // Should we check if handle is element (do we want sanity checks?)
                if (ELEMENT_NODE != (nodes.readEntry(nodeHandle, 0) & 0xFFFF))
                        return NULL;
                // First Attribute (if any) should be at next position in table
                nodeHandle++;
                return(ATTRIBUTE_NODE == (nodes.readEntry(nodeHandle, 0) & 0xFFFF)) ?
                nodeHandle | m_docHandle : NULL;
        }
53848
public static <T> T visitField(FieldDescriptor fieldDescriptor, FieldVisitor<T> visitor) {
    // NOTE: map fields are technically repeated, so check isMap first.
    if (fieldDescriptor.isMapField()) {
      List<FieldDescriptor> mapFields = fieldDescriptor.getMessageType().getFields();
      checkState(mapFields.size() == 2, "proto representation of map fields changed");
      FieldDescriptor keyField = mapFields.get(0);
      FieldDescriptor valueField = mapFields.get(1);
      return visitor.visitMap(
          fieldDescriptor, getScalarType(keyField, visitor), getScalarType(valueField, visitor));
    } else if (fieldDescriptor.isRepeated()) {
      return visitor.visitRepeated(getScalarType(fieldDescriptor, visitor));
    } else {
      return getScalarType(fieldDescriptor, visitor);
    }
  }
589590
private void visitList(final ObjectGraphNode node) {
		int index = 0;

		for (Iterator i = ((List) node.getValue()).iterator(); i.hasNext();) {
			Object entry = i.next();
			String entryType = entry == null ? Object.class.getName() : entry.getClass().getName();

			ObjectGraphNode childNode = new ObjectGraphNode(++nodeCount, "[" + index++ + "]",
					entryType, entry);
			node.add(childNode);
			visit(childNode);
		}

		adjustOverhead(node);
	}
1144635
public TrieNode visitFirst(Consumer<? super TrieNode> visitor) {
    visitor.accept(this);
    TrieNode refresh = refresh();
    refresh.getChildren().forEach(n -> n.visitFirst(visitor));
    return refresh;
  }
822239
@Override
    public R visitStartElement(StartElementTree node, P p) {
        return scan(node.getAttributes(), p);
    }
768874
@Override
    public void visit(NodeVisitor v) {
        if (v.visit(this)) {
            expression.visit(v);
            for (SwitchCase sc: getCases()) {
                sc.visit(v);
            }
        }
    }
348842
@Override
    public void visit(NodeVisitor v) {
        if (v.visit(this)) {
            for (AstNode e : getElements()) {
                e.visit(v);
            }
        }
    }
617139
public static void visit(Object instance, TypeToken<?> inspectType, Visitor firstVisitor, Visitor... moreVisitors) {

    try {
      List<Visitor> visitors = ImmutableList.<Visitor>builder().add(firstVisitor).add(moreVisitors).build();

      for (TypeToken<?> type : inspectType.getTypes().classes()) {
        if (Object.class.equals(type.getRawType())) {
          break;
        }

        for (Field field : type.getRawType().getDeclaredFields()) {
          if (!field.isAccessible()) {
            field.setAccessible(true);
          }
          for (Visitor visitor : visitors) {
            visitor.visit(instance, inspectType, type, field);
          }
        }

        for (Method method : type.getRawType().getDeclaredMethods()) {
          if (!method.isAccessible()) {
            method.setAccessible(true);
          }
          for (Visitor visitor : visitors) {
            visitor.visit(instance, inspectType, type, method);
          }
        }
      }
    } catch (Exception e) {
      throw Throwables.propagate(e);
    }
  }
1309618
private static Node getNthSibling(Node first, int index) {
    Node sibling = first;
    while (index != 0 && sibling != null) {
      sibling = sibling.getNext();
      index--;
    }
    return sibling;
  }
1344872
public static void visitAllNodes(Node node, NodeVisitor<? super Node, VisitDirective> visitor) {
    ArrayDeque<Node> queue = new ArrayDeque<>();
    queue.add(node);
    Node current;
    while ((current = queue.poll()) != null) {
      switch (visitor.exec(current)) {
        case ABORT:
          return;
        case CONTINUE:
          if (current instanceof ParentNode<?>) {
            queue.addAll(((ParentNode<?>) current).getChildren());
          }
          if (current instanceof ExprHolderNode) {
            queue.addAll(((ExprHolderNode) current).getExprList());
          }
          continue;
        case SKIP_CHILDREN:
          continue;
      }
    }
  }
93830
@Override
	public Resource asVisitorResource() {
		URL url = null;
		try {
			url = getURI().toURL();
		} catch (MalformedURLException ignore) {
		}
		return new VisitorResource(url, ""); //$NON-NLS-1$
	}
922662
@Override
    public void visit(NodeVisitor v) {
        if (v.visit(this) && value != null) {
            value.visit(v);
        }
    }
625982
public RequestTable<T> forEachNonBlocking(Visitor<T> visitor) {
        if(visitor == null) return null;
        T[]  buf;
        long lo, hi;
        lock.lock();
        try {
            buf=this.buffer; lo=this.low; hi=this.high;
        }
        finally {
            lock.unlock();
        }

        for(long i=lo, num_iterations=0; i < hi && num_iterations < buf.length; i++, num_iterations++) {
            int index=index(i);
            T el=buf[index];
            if(!visitor.visit(el))
                break;
        }
        return this;
    }