public final void change_entries(BrdTracep p_obj,Polyline p_new_polyline,int p_keep_at_start_count,int p_keep_at_end_count){
  int compensated_half_width=p_obj.get_half_width() + get_clearance_compensation(p_obj.clearance_idx(),p_obj.get_layer());
  ArrayList<ShapeTile> changed_shapes=offset_shapes(p_new_polyline,compensated_half_width,p_keep_at_start_count,p_new_polyline.plaline_len(-1) - p_keep_at_end_count);
  int old_shape_count=p_obj.tree_shape_count(this);
  int new_shape_count=changed_shapes.size() + p_keep_at_start_count + p_keep_at_end_count;
  AwtreeNodeLeaf[] new_leaf_arr=new AwtreeNodeLeaf[new_shape_count];
  ShapeTile[] new_precalculated_tree_shapes=new ShapeTile[new_shape_count];
  AwtreeNodeLeaf[] old_entries=p_obj.get_search_tree_entries(this);
  for (int index=0; index < p_keep_at_start_count; ++index) {
    new_leaf_arr[index]=old_entries[index];
    new_precalculated_tree_shapes[index]=p_obj.get_tree_shape(this,index);
  }
  for (int index=p_keep_at_start_count; index < old_shape_count - p_keep_at_end_count; ++index) {
    remove_leaf(old_entries[index]);
  }
  for (int i=0; i < p_keep_at_end_count; ++i) {
    int new_index=new_shape_count - p_keep_at_end_count + i;
    int old_index=old_shape_count - p_keep_at_end_count + i;
    new_leaf_arr[new_index]=old_entries[old_index];
    new_leaf_arr[new_index].shape_index_in_object=new_index;
    new_precalculated_tree_shapes[new_index]=p_obj.get_tree_shape(this,old_index);
  }
  for (int index=p_keep_at_start_count; index < new_shape_count - p_keep_at_end_count; ++index) {
    new_precalculated_tree_shapes[index]=changed_shapes.get(index - p_keep_at_start_count);
  }
  p_obj.set_precalculated_tree_shapes(new_precalculated_tree_shapes,this);
  for (int index=p_keep_at_start_count; index < new_shape_count - p_keep_at_end_count; ++index) {
    new_leaf_arr[index]=insert(p_obj,index);
  }
  p_obj.set_search_tree_entries(this,new_leaf_arr);
}

public final void change_entries ( BrdTracep p_obj , Polyline p_new_polyline , int p_keep_at_start_count , int p_keep_at_end_count ) { int compensated_half_width = p_obj . get_half_width ( ) + get_clearance_compensation ( p_obj . clearance_idx ( ) , p_obj . get_layer ( ) ) ; ArrayList < ShapeTile > changed_shapes = offset_shapes ( p_new_polyline , compensated_half_width , p_keep_at_start_count , p_new_polyline . plaline_len ( - 1 ) - p_keep_at_end_count ) ; int old_shape_count = p_obj . tree_shape_count ( this ) ; int new_shape_count = changed_shapes . size ( ) + p_keep_at_start_count + p_keep_at_end_count ; AwtreeNodeLeaf [ ] new_leaf_arr = new AwtreeNodeLeaf [ new_shape_count ] ; ShapeTile [ ] new_precalculated_tree_shapes = new ShapeTile [ new_shape_count ] ; AwtreeNodeLeaf [ ] old_entries = p_obj . get_search_tree_entries ( this ) ; for ( int index = 0 ; index < p_keep_at_start_count ; ++ index ) { new_leaf_arr [ index ] = old_entries [ index ] ; new_precalculated_tree_shapes [ index ] = p_obj . get_tree_shape ( this , index ) ; } for ( int index = p_keep_at_start_count ; index < old_shape_count - p_keep_at_end_count ; ++ index ) { remove_leaf ( old_entries [ index ] ) ; } for ( int i = 0 ; i < p_keep_at_end_count ; ++ i ) { int new_index = new_shape_count - p_keep_at_end_count + i ; int old_index = old_shape_count - p_keep_at_end_count + i ; new_leaf_arr [ new_index ] = old_entries [ old_index ] ; new_leaf_arr [ new_index ] . shape_index_in_object = new_index ; new_precalculated_tree_shapes [ new_index ] = p_obj . get_tree_shape ( this , old_index ) ; } for ( int index = p_keep_at_start_count ; index < new_shape_count - p_keep_at_end_count ; ++ index ) { new_precalculated_tree_shapes [ index ] = changed_shapes . get ( index - p_keep_at_start_count ) ; } p_obj . set_precalculated_tree_shapes ( new_precalculated_tree_shapes , this ) ; for ( int index = p_keep_at_start_count ; index < new_shape_count - p_keep_at_end_count ; ++ index ) { new_leaf_arr [ index ] = insert ( p_obj , index ) ; } p_obj . set_search_tree_entries ( this , new_leaf_arr ) ; }
changes the tree entries from p_keep_at_start_count + 1 to new_shape_count - 1 - keep_at_end_count to p_changed_entries . special implementation for change_trace for performance reasons
