parameters: (self)
docstring: This function works by walking through slices by start time.
  
       The basic idea here is to insert each slice as deep into the subrow
       list as it can go such that every subslice is fully contained by its
       parent slice.
  
       Visually, if we start with this:
        0:  [    a       ]
        1:    [  b  ]
        2:    [c][d]
  
       To place this slice:
                     [e]
       We first check row 2's last item, [d]. [e] wont fit into [d] (they dont
       even intersect). So we go to row 1. That gives us [b], and [d] wont fit
       into that either. So, we go to row 0 and its last slice, [a]. That can
       completely contain [e], so that means we should add [e] as a subslice
       of [a]. That puts it on row 1, yielding:
        0:  [    a       ]
        1:    [  b  ][e]
        2:    [c][d]
  
       If we then get this slice:
                            [f]
       We do the same deepest-to-shallowest walk of the subrows trying to fit
       it. This time, it doesn't fit in any open slice. So, we simply append
       it to row 0 (a root slice):
        0:  [    a       ]  [f]
        1:    [  b  ][e]
docstring_summary: This function works by walking through slices by start time.
docstring_tokens: This function works by walking through slices by start time .
function: def _BuildSliceSubRows(self):
      '''This function works by walking through slices by start time.
  
       The basic idea here is to insert each slice as deep into the subrow
       list as it can go such that every subslice is fully contained by its
       parent slice.
  
       Visually, if we start with this:
        0:  [    a       ]
        1:    [  b  ]
        2:    [c][d]
  
       To place this slice:
                     [e]
       We first check row 2's last item, [d]. [e] wont fit into [d] (they dont
       even intersect). So we go to row 1. That gives us [b], and [d] wont fit
       into that either. So, we go to row 0 and its last slice, [a]. That can
       completely contain [e], so that means we should add [e] as a subslice
       of [a]. That puts it on row 1, yielding:
        0:  [    a       ]
        1:    [  b  ][e]
        2:    [c][d]
  
       If we then get this slice:
                            [f]
       We do the same deepest-to-shallowest walk of the subrows trying to fit
       it. This time, it doesn't fit in any open slice. So, we simply append
       it to row 0 (a root slice):
        0:  [    a       ]  [f]
        1:    [  b  ][e]
      '''
      def CompareSlices(s1, s2):
        if s1.start == s2.start:
          # Break ties by having the slice with the greatest
          # end timestamp come first.
          return cmp(s2.end, s1.end)
        return cmp(s1.start, s2.start)
  
      assert len(self._toplevel_slices) == 0
      if not len(self._newly_added_slices):
        return
  
      sorted_slices = sorted(self._newly_added_slices, cmp=CompareSlices)
      root_slice = sorted_slices[0]
      self._toplevel_slices.append(root_slice)
      for s in sorted_slices[1:]:
        if not self._AddSliceIfBounds(root_slice, s):
          root_slice = s
          self._toplevel_slices.append(root_slice)
      self._newly_added_slices = []
function_tokens: def _BuildSliceSubRows ( self ) : def CompareSlices ( s1 , s2 ) : if s1 . start == s2 . start : # Break ties by having the slice with the greatest # end timestamp come first. return cmp ( s2 . end , s1 . end ) return cmp ( s1 . start , s2 . start ) assert len ( self . _toplevel_slices ) == 0 if not len ( self . _newly_added_slices ) : return sorted_slices = sorted ( self . _newly_added_slices , cmp = CompareSlices ) root_slice = sorted_slices [ 0 ] self . _toplevel_slices . append ( root_slice ) for s in sorted_slices [ 1 : ] : if not self . _AddSliceIfBounds ( root_slice , s ) : root_slice = s self . _toplevel_slices . append ( root_slice ) self . _newly_added_slices = [ ]