question: private void updateSelection ( Mode mode , Projection2D proj , SVGPoint p1 , SVGPoint p2 ) { DBIDSelection selContext = context . getSelection ( ) ; HashSetModifiableDBIDs selection ; if ( selContext == null || mode == Mode . REPLACE ) { selection = DBIDUtil . newHashSet ( ) ; } else { selection = DBIDUtil . newHashSet ( selContext . getSelectedIds ( ) ) ; } for ( DBIDIter iditer = rel . iterDBIDs ( ) ; iditer . valid ( ) ; iditer . advance ( ) ) { double [ ] vec = proj . fastProjectDataToRenderSpace ( rel . get ( iditer ) ) ; if ( vec [ 0 ] >= Math . min ( p1 . getX ( ) , p2 . getX ( ) ) && vec [ 0 ] <= Math . max ( p1 . getX ( ) , p2 . getX ( ) ) && vec [ 1 ] >= Math . min ( p1 . getY ( ) , p2 . getY ( ) ) && vec [ 1 ] <= Math . max ( p1 . getY ( ) , p2 . getY ( ) ) ) { if ( mode == Mode . INVERT ) { if ( ! selection . contains ( iditer ) ) { selection . add ( iditer ) ; } else { selection . remove ( iditer ) ; } } else { selection . add ( iditer ) ; } } } context . setSelection ( new DBIDSelection ( selection ) ) ; }
target:  Updates the selection in the context.<br>