## Merging FrameSets

As well as adding individual Frames to a FrameSetFrameSet (§13.3), it is also possible to add complete sets of inter-related Frames which are contained within another FrameSet. This, of course, corresponds to the process of merging two FrameSets (Figure 18).

Figure 18: Two FrameSets in the process of being merged using astAddFrameastAddFrame. FrameSet B is being added to FrameSet A by supplying a new MappingMapping which inter-relates a nominated FrameFrame in A (here number 1) and the current Frame of B. In the merged FrameSet, the Frames contributed by B will be re-numbered to become Frames 4, 5 and 6. The base Frame will remain unchanged, but the current Frame of B becomes the new current Frame. Note that FrameSet B itself is not altered by this process.
[width=0.7]sun211_figures/fsmerge

This process is performed by adding one FrameSet to another using astAddFrame, in much the same manner as when adding a new Frame to an existing FrameSet (§13.3). It is simply a matter of providing a FrameSet pointer, instead of a Frame pointer, for the 4th argument. In performing the merger you must, as usual, supply a Mapping, but in this case the Mapping should relate the current Frame of the FrameSet being added to one of the Frames already present. For example, you might perform the merger shown in Figure 18 as follows:

226#226

The Frames acquired by “frameseta” from the FrameSet being added (“framesetb”) are re-numbered so that they retain their original order and follow on consecutively after the Frames that were already present, whose indices remain unchanged. The base Frame of “frameseta” remains unchanged, but the current Frame of “framesetb” becomes its new current Frame. All the inter-relationships between Frames in both FrameSets remain in place and are preserved in the merged FrameSet.

Note that while this process modifies the first FrameSet (“frameseta”), it leaves the original contents of the one being added (“framesetb”) unchanged.