ScrollHelper (@NotNull ThreeSide master, @NotNull ThreeSide slave) { assert master != slave; assert master == ThreeSide.BASE || slave == ThreeSide.BASE; boolean leftSide = master == ThreeSide.LEFT || slave == ThreeSide.LEFT; SyncScrollable scrollable = leftSide ? myScrollable12 : myScrollable23; Side side; if (leftSide) { // LEFT - BASE -> LEFT // BASE - LEFT -> RIGHT side = Side.fromLeft(master == ThreeSide.LEFT); } else { // BASE - RIGHT -> LEFT // RIGHT - BASE -> RIGHT side = Side.fromLeft(master == ThreeSide.BASE); } return new ScrollHelper(myEditors, master.getIndex(), slave.getIndex(), scrollable, side); }