private void removeOrTransformHasContainers ( final SchemaTableTree schemaTableTree ) { Set < HasContainer > toRemove = new HashSet <> ( ) ; Set < HasContainer > toAdd = new HashSet <> ( ) ; for ( HasContainer hasContainer : schemaTableTree . hasContainers ) { if ( hasContainer . getKey ( ) . equals ( label . getAccessor ( ) ) ) { toRemove . add ( hasContainer ) ; } if ( Existence . NULL . equals ( hasContainer . getBiPredicate ( ) ) ) { // we checked that a non existing property was null, that's fine if ( ! this . getFilteredAllTables ( ) . get ( schemaTableTree . getSchemaTable ( ) . toString ( ) ) . containsKey ( hasContainer . getKey ( ) ) ) { toRemove . add ( hasContainer ) ; } } if ( Contains . without . equals ( hasContainer . getBiPredicate ( ) ) ) { Object o = hasContainer . getValue ( ) ; if ( o instanceof Collection && ( ( Collection < ? > ) o ) . size ( ) == 0 ) { //P.without(Collections.emptySet()) translates to the sql IS NOT NULL toRemove . add ( hasContainer ) ; toAdd . add ( new HasContainer ( hasContainer . getKey ( ) , new P <> ( Existence . NOTNULL , null ) ) ) ; } } } schemaTableTree . hasContainers . removeAll ( toRemove ) ; schemaTableTree . hasContainers . addAll ( toAdd ) ; }
remove has containers that are not valid anymore transform has containers that are equivalent to simpler statements .