ImageEngine/gaffer — pull request #1042 by johnhaddon (2014-10-14 13:27:28+00:00)
Title: Added Group::nextInPlug() method.

I made this always return the very last plug, which is guaranteed to have no input, even in the case where an earlier plug has no input as well. In the example below, it's the highlighted plug, "in3", that will be returned.

![nextinplug](https://cloud.githubusercontent.com/assets/1133871/4629533/446d18d4-53a5-11e4-8f26-cb0023c4f94b.png)

My rationale was that the order is relevant when deciding which locations to rename when inputs have locations with the same name, so it was best always to connect at the end for consistency. When connecting a new input via `nextInPlug()`, it will always be the last one, so will always be the one that is renamed to avoid conflicts with the existing inputs. I'm not 100% sure about that decision, so if anyone wants to argue for reuse of the earlier plug (but with less clear renaming semantics), then please do.