private int updateSize ( ) { int size = 0 ; if ( collectionPointer != null ) { final OSBTreeBonsai < OIdentifiable , Integer > tree = loadTree ( ) ; if ( tree == null ) { throw new IllegalStateException ( "RidBag is not properly initialized, can not load tree implementation" ) ; } try { size = tree . getRealBagSize ( changes ) ; } finally { releaseTree ( ) ; } } else { for ( Change change : changes . values ( ) ) { size += change . applyTo ( 0 ) ; } } for ( OModifiableInteger diff : newEntries . values ( ) ) { size += diff . getValue ( ) ; } this . size = size ; return size ; }
Recalculates real bag size .