public void insert(IntermediateOperation operationToInsert, int inputNumber) {
        if (!operationToInsert.inputs.isEmpty()) {
            throw new IllegalArgumentException("Operation to insert to '" + name + "' has " +
                                               "existing inputs which is not supported.");
        }
        IntermediateOperation previousInputOperation = inputs.get(inputNumber);
        int outputNumber = findOutputNumber(previousInputOperation, this);
        if (outputNumber == -1) {
            throw new IllegalArgumentException("Input '" + previousInputOperation.name + "' to '" +
                                               name + "' does not have '" + name + "' as output.");
        }
        previousInputOperation.outputs.set(outputNumber, operationToInsert);
        operationToInsert.inputs.add(previousInputOperation);
        operationToInsert.outputs.add(this);
        inputs.set(inputNumber, operationToInsert);
    }
Insert an operation between an input and this one
model-integration/src/main/java/ai/vespa/rankingexpression/importer/operations/IntermediateOperation.java