public boolean removeFactPattern ( int index ) { final int newSize = ( ( index >= 0 && index < this . patterns . length ) ? this . patterns . length - 1 : this . patterns . length ) ; final IFactPattern [ ] newList = new IFactPattern [ newSize ] ; boolean deleted = false ; int newIdx = 0 ; for ( int i = 0 ; i < this . patterns . length ; i ++ ) { if ( i != index ) { newList [ newIdx ] = this . patterns [ i ] ; newIdx ++ ; } else { deleted = true ; } } this . patterns = newList ; return deleted ; }
Remove a FactPattern at the provided index . If index is less than zero or greater than or equal to the number of patterns the effect of this method is no operation .