Add prepare bridge methods for all classes/interfaces between the leaf
(genericised class) and the root (genericised baseclass).

@param cf file to which to add the prepare bridge
@param leaf leaf class
@since 1.2
162313
public static void definePrepareBridges(ClassFile cf, Class leaf) {
        for (Class c : gatherAllBridgeTypes(new HashSet<Class>(), leaf)) {
            if (c != Object.class) {
                definePrepareBridge(cf, leaf, c);
            }
        }
    }
672075
public void onLeafClick(LeafClickEvent event) {
		LayerTreeTreeNode layerTreeNode;
		if (event.getLeaf() instanceof LayerTreeLegendItemNode) {
			layerTreeNode = ((LayerTreeLegendItemNode) event.getLeaf()).parent;
			treeGrid.deselectRecord(event.getLeaf());
			treeGrid.selectRecord(layerTreeNode);
		} else {
			layerTreeNode = (LayerTreeTreeNode) event.getLeaf();
		}

		// -- update model
		mapModel.selectLayer(layerTreeNode.getLayer());
	}
759440
public void addFirstChild( AstNode child ) {
        assert child != null;
        this.children.addFirst(child);
        child.removeFromParent();
        child.parent = this;
    }
677885
protected void addClassListing(HtmlTree contentTree) {
        Configuration config = configuration;
        if (utils.isSpecified(packageElement)) {
            addClassKindListing(utils.getInterfaces(packageElement),
                contents.interfaces, contentTree);
            addClassKindListing(utils.getOrdinaryClasses(packageElement),
                contents.classes, contentTree);
            addClassKindListing(utils.getEnums(packageElement),
                contents.enums, contentTree);
            addClassKindListing(utils.getExceptions(packageElement),
                contents.exceptions, contentTree);
            addClassKindListing(utils.getErrors(packageElement),
                contents.errors, contentTree);
            addClassKindListing(utils.getAnnotationTypes(packageElement),
                contents.annotationTypes, contentTree);
        } else {
            addClassKindListing(config.typeElementCatalog.interfaces(packageElement),
                contents.interfaces, contentTree);
            addClassKindListing(config.typeElementCatalog.ordinaryClasses(packageElement),
                contents.classes, contentTree);
            addClassKindListing(config.typeElementCatalog.enums(packageElement),
                contents.enums, contentTree);
            addClassKindListing(config.typeElementCatalog.exceptions(packageElement),
                contents.exceptions, contentTree);
            addClassKindListing(config.typeElementCatalog.errors(packageElement),
                contents.errors, contentTree);
            addClassKindListing(config.typeElementCatalog.annotationTypes(packageElement),
                contents.annotationTypes, contentTree);
        }
    }
101917
protected boolean tryBridgeMethod(MethodNode target, Expression receiver, boolean implicitThis,
                                      TupleExpression args, ClassNode thisClass) {
        ClassNode lookupClassNode;
        if (target.isProtected()) {
            lookupClassNode = controller.getClassNode();
            while (lookupClassNode != null && !lookupClassNode.isDerivedFrom(target.getDeclaringClass())) {
                lookupClassNode = lookupClassNode.getOuterClass();
            }
            if (lookupClassNode == null) {
                return false;
            }
        } else {
            lookupClassNode = target.getDeclaringClass().redirect();
        }
        Map<MethodNode, MethodNode> bridges = lookupClassNode.getNodeMetaData(PRIVATE_BRIDGE_METHODS);
        MethodNode bridge = bridges==null?null:bridges.get(target);
        if (bridge != null) {
            Expression fixedReceiver = receiver;
            if (implicitThis) {
                if (!controller.isInClosure()) {
                    fixedReceiver = new PropertyExpression(new ClassExpression(lookupClassNode), "this");
                } else if (thisClass != null) {
                    ClassNode current = thisClass.getOuterClass();
                    fixedReceiver = new VariableExpression("thisObject", current);
                    // adjust for multiple levels of nesting if needed
                    while (current instanceof InnerClassNode && !lookupClassNode.equals(current)) {
                        FieldNode thisField = current.getField("this$0");
                        current = current.getOuterClass();
                        if (thisField != null) {
                            fixedReceiver = new PropertyExpression(fixedReceiver, "this$0");
                            fixedReceiver.setType(current);
                        }
                    }
                }
            }
            ArgumentListExpression newArgs = new ArgumentListExpression(target.isStatic()?new ConstantExpression(null):fixedReceiver);
            for (Expression expression : args.getExpressions()) {
                newArgs.addExpression(expression);
            }
            return writeDirectMethodCall(bridge, implicitThis, fixedReceiver, newArgs);
        }
        return false;
    }
575043
private void connectToPossibleExceptionHandler(Node cfgNode, Node target) {
    if (mayThrowException(target) && !exceptionHandler.isEmpty()) {
      Node lastJump = cfgNode;
      for (Node handler : exceptionHandler) {
        if (handler.isFunction()) {
          return;
        }
        checkState(handler.isTry());
        Node catchBlock = NodeUtil.getCatchBlock(handler);

        boolean lastJumpInCatchBlock = false;
        for (Node ancestor : lastJump.getAncestors()) {
          if (ancestor == handler) {
            break;
          } else if (ancestor == catchBlock) {
            lastJumpInCatchBlock = true;
            break;
          }
        }

        // No catch but a FINALLY, or lastJump is inside the catch block.
        if (!NodeUtil.hasCatchHandler(catchBlock) || lastJumpInCatchBlock) {
          if (lastJump == cfgNode) {
            createEdge(cfgNode, Branch.ON_EX, handler.getLastChild());
          } else {
            finallyMap.put(lastJump, handler.getLastChild());
          }
        } else { // Has a catch.
          if (lastJump == cfgNode) {
            createEdge(cfgNode, Branch.ON_EX, catchBlock);
            return;
          } else {
            finallyMap.put(lastJump, catchBlock);
          }
        }
        lastJump = handler;
      }
    }
  }
857344
public static void addDeclaredMethodsFromInterfaces(ClassNode cNode, Map<String, MethodNode> methodsMap) {
        // add in unimplemented abstract methods from the interfaces
        for (ClassNode iface : cNode.getInterfaces()) {
            Map<String, MethodNode> ifaceMethodsMap = iface.getDeclaredMethodsMap();
            for (Map.Entry<String, MethodNode> entry : ifaceMethodsMap.entrySet()) {
                String methSig = entry.getKey();
                if (!methodsMap.containsKey(methSig)) {
                    methodsMap.put(methSig, entry.getValue());
                }
            }
        }
    }
1014457
def before_after_apply(self, before_fn, after_fn, leaf_fn=None):
        
        stack = [self]
        while stack:
            node = stack.pop()
            if node.is_leaf:
                if leaf_fn:
                    leaf_fn(node)
                while node.is_last_child_of_parent:
                    node = node._parent
                    if node:
                        after_fn(node)
                    else:
                        break
            else:
                before_fn(node)
                stack.extend([i for i in reversed(node._children)])
1117770
@Override
    public void treeConnectLogon () throws SmbException {
        String logonShare = getContext().getConfig().getLogonShare();
        if ( logonShare == null || logonShare.isEmpty() ) {
            throw new SmbException("Logon share is not defined");
        }
        try ( SmbTreeImpl t = getSmbTree(logonShare, null) ) {
            t.treeConnect(null, null);
        }
        catch ( CIFSException e ) {
            throw SmbException.wrap(e);
        }
    }
668558
protected void initBridge(ServiceLocator locator, Injector injector) {

        // Set up bridge
        GuiceBridge.getGuiceBridge().initializeGuiceBridge(locator);
        GuiceIntoHK2Bridge guiceBridge = locator.getService(GuiceIntoHK2Bridge.class);
        guiceBridge.bridgeGuiceInjector(injector);
        injectMultibindings(locator, injector);

        // Bind guice scope context
        ServiceLocatorUtilities.bind(locator, new AbstractBinder() {
            @Override
            protected void configure() {
                bind(GuiceScopeContext.class).to(new TypeLiteral<Context<GuiceScope>>() {
                }).in(Singleton.class);
            }
        });
    }
1284925
private void addLeafLabel() {
        final int nodeKind = mRtx.getNode().getKind();
        if (!mLeafLabels.containsKey(nodeKind)) {
            mLeafLabels.put(nodeKind, new ArrayList<ITreeData>());
        }
        mLeafLabels.get(nodeKind).add(mRtx.getNode());
    }
1031281
void bofFixup() {
           //
           //   The parse tree looks like this ...
           //         fTree root  --.       <cat>
           //                               /     \
           //                            <cat>   <#end node>
           //                           /     \
           //                     <bofNode>   rest
           //                               of tree
           //
           //    We will be adding things to the followPos set of the <bofNode>
           //
           RBBINode  bofNode = fRB.fTreeRoots[fRootIx].fLeftChild.fLeftChild;
           Assert.assrt(bofNode.fType == RBBINode.leafChar);
           Assert.assrt(bofNode.fVal == 2);

           // Get all nodes that can be the start a match of the user-written rules
           //  (excluding the fake bofNode)
           //  We want the nodes that can start a match in the
           //     part labeled "rest of tree"
           //
           Set<RBBINode> matchStartNodes = fRB.fTreeRoots[fRootIx].fLeftChild.fRightChild.fFirstPosSet;
           for (RBBINode startNode : matchStartNodes) {
               if (startNode.fType != RBBINode.leafChar) {
                   continue;
               }

               if (startNode.fVal == bofNode.fVal) {
                   //  We found a leaf node corresponding to a {bof} that was
                   //    explicitly written into a rule.
                   //  Add everything from the followPos set of this node to the
                   //    followPos set of the fake bofNode at the start of the tree.
                   //
                   bofNode.fFollowPos.addAll(startNode.fFollowPos);
               }
           }
       }
699345
public boolean addBridge(BetaBridge bridge) {
		if (bridge1 == null) {
			bridge1 = bridge;
			return true;
		} else if (bridge1.equals(bridge)) {
			return true;
		} else if (bridge2 == null) {
			bridge2 = bridge;
			return true;
		} else if (bridge2.equals(bridge)) {
			return true;
		} else { //no space left, cannot add the bridge
			logger.info("Residue forms more than 2 beta Bridges, "
					+ "DSSP output might differ in Bridges column.");
			return false;
		}
	}
87284
private void defineWriteBridgeMethod()
    {
        classDefinition.addMethod(
                new MethodDefinition(a(PUBLIC, BRIDGE, SYNTHETIC), "write", null, arg("struct", Object.class), arg("protocol", TProtocol.class))
                        .addException(Exception.class)
                        .loadThis()
                        .loadVariable("struct", structType)
                        .loadVariable("protocol")
                        .invokeVirtual(
                                codecType,
                                "write",
                                type(void.class),
                                structType,
                                type(TProtocol.class)
                        )
                        .ret()
        );
    }
1084891
protected void addClassListing(HtmlTree contentTree) {
        List<PackageElement> packagesIn = ElementFilter.packagesIn(mdle.getEnclosedElements());
        SortedSet<TypeElement> interfaces = new TreeSet<>(utils.makeGeneralPurposeComparator());
        SortedSet<TypeElement> classes = new TreeSet<>(utils.makeGeneralPurposeComparator());
        SortedSet<TypeElement> enums = new TreeSet<>(utils.makeGeneralPurposeComparator());
        SortedSet<TypeElement> exceptions = new TreeSet<>(utils.makeGeneralPurposeComparator());
        SortedSet<TypeElement> errors = new TreeSet<>(utils.makeGeneralPurposeComparator());
        SortedSet<TypeElement> annotationTypes = new TreeSet<>(utils.makeGeneralPurposeComparator());
        for (PackageElement pkg : packagesIn) {
            if (utils.isIncluded(pkg)) {
                interfaces.addAll(utils.getInterfaces(pkg));
                classes.addAll(utils.getOrdinaryClasses(pkg));
                enums.addAll(utils.getEnums(pkg));
                exceptions.addAll(utils.getExceptions(pkg));
                errors.addAll(utils.getErrors(pkg));
                annotationTypes.addAll(utils.getAnnotationTypes(pkg));
            }
        }
        addClassKindListing(interfaces, contents.interfaces, contentTree);
        addClassKindListing(classes, contents.classes, contentTree);
        addClassKindListing(enums, contents.enums, contentTree);
        addClassKindListing(exceptions, contents.exceptions, contentTree);
        addClassKindListing(errors, contents.errors, contentTree);
        addClassKindListing(annotationTypes, contents.annotationTypes, contentTree);
    }
1372238
public void addClassNodeToCompile(ClassNode node, SourceUnit location) {
        classesToCompile.put(node.getName(), node);
        classNameToSource.put(node.getName(), location);
    }
904555
protected void prepareActions() throws QTasteTestFailException {

			if (mSelectorIdentifier == SelectorIdentifier.CLEAR_SELECTION) {
				// nothing special to do for CLEAR_SELECTION action
				return;
			}

			String nodePath = mData[0].toString();
			String nodePathSeparator = mData[1].toString();

			// Split node path into an array of node path elements
			// Be careful that String.split() method takes a regex as argument.
			// Here, the token 'nodePathSeparator' is escaped using the Pattern.quote() method.
			String[] nodePathElements = nodePath.split(Pattern.quote(nodePathSeparator));

			if (nodePathElements.length == 0) {
				throw new QTasteTestFailException(
                  "Unable to split the node path in elements (nodePath: '" + nodePath + "' separator: '" + nodePathSeparator
                        + "')");
			}

			LOGGER.trace("nodePath: " + nodePath + " separator: " + nodePathSeparator + " splitted in " + nodePathElements.length
				+ " element(s).");

			if (component instanceof JTree) {
				JTree tree = (JTree) component;
			} else {
				throw new QTasteTestFailException(
						"Invalid component class (expected: JTree, got: " + component.getClass().getName() + ").");
			}
	}