question: private void mergeDRINode ( Node node ) throws IIOInvalidTreeException { DRIMarkerSegment dri = ( DRIMarkerSegment ) findMarkerSegment ( DRIMarkerSegment . class , true ) ; if ( dri != null ) { dri . updateFromNativeNode ( node , false ) ; } else { DRIMarkerSegment newGuy = new DRIMarkerSegment ( node ) ; int firstSOF = findMarkerSegmentPosition ( SOFMarkerSegment . class , true ) ; int firstSOS = findMarkerSegmentPosition ( SOSMarkerSegment . class , true ) ; if ( firstSOF != - 1 ) { markerSequence . add ( firstSOF , newGuy ) ; } else if ( firstSOS != - 1 ) { markerSequence . add ( firstSOS , newGuy ) ; } else { markerSequence . add ( newGuy ) ; } } }
target:  Merge the given DRI node into the marker sequence. If there already exists a DRI marker segment, the restart interval value is updated. If there is no DRI segment, then a new one is created and added as follows: If there is an SOF segment, the new DRI segment is inserted before it. If there is no SOF segment, the new DRI segment is inserted before the first SOS segment, if there is one. If there is no SOS segment, the new DRI segment is added to the end of the sequence.