/// Combine two `EnvMBE`s whose names (both environment names and repeat names) are disjoint,
/// or just overwrite the contents of the previous one.
/// This should maybe not be `pub` if we can avoid it.
/// Note: ideally, the larger one should be on the LHS.
Combine two `EnvMBE`s whose names (both environment names and repeat names) are disjoint,
or just overwrite the contents of the previous one.
This should maybe not be `pub` if we can avoid it.
Note: ideally, the larger one should be on the LHS.
Combine two ` EnvMBE ` s whose names ( both environment names and repeat names ) are disjoint or just overwrite the contents of the previous one . This should maybe not be ` pub ` if we can avoid it . Note : ideally the larger one should be on the LHS .
pub fn combine_overriding(&self, rhs: &EnvMBE<T>) -> EnvMBE<T> {
        let adjust_rhs_by = self.repeats.len();
        let mut new_repeats = self.repeats.clone();
        new_repeats.append(&mut rhs.repeats.clone());
        let mut new__ddd_rep_idxes = self.ddd_rep_idxes.clone();
        new__ddd_rep_idxes.append(&mut rhs.ddd_rep_idxes.clone());
        EnvMBE {
            leaves: self.leaves.set_assoc(&rhs.leaves),
            repeats: new_repeats,
            ddd_rep_idxes: new__ddd_rep_idxes,
            leaf_locations: self.leaf_locations.set_assoc(
                &rhs.leaf_locations.map(|idx_opt| idx_opt.map(|idx| idx + adjust_rhs_by)),
            ),
            named_repeats: self.named_repeats.set_assoc(
                &rhs.named_repeats.map(|idx_opt| idx_opt.map(|idx| idx + adjust_rhs_by)),
            ),
        }
    }
pub fn combine_overriding ( & self , rhs : & EnvMBE < T > ) -> EnvMBE < T > { let adjust_rhs_by = self . repeats . len ( ) ; let mut new_repeats = self . repeats . clone ( ) ; new_repeats . append ( & mut rhs . repeats . clone ( ) ) ; let mut new__ddd_rep_idxes = self . ddd_rep_idxes . clone ( ) ; new__ddd_rep_idxes . append ( & mut rhs . ddd_rep_idxes . clone ( ) ) ; EnvMBE { leaves : self . leaves . set_assoc ( & rhs . leaves ) , repeats : new_repeats , ddd_rep_idxes : new__ddd_rep_idxes , leaf_locations : self . leaf_locations . set_assoc ( & rhs . leaf_locations . map ( | idx_opt | idx_opt . map ( | idx | idx + adjust_rhs_by ) ) , ) , named_repeats : self . named_repeats . set_assoc ( & rhs . named_repeats . map ( | idx_opt | idx_opt . map ( | idx | idx + adjust_rhs_by ) ) , ) , } }
Combine two `EnvMBE`s whose names (both environment names and repeat names) are disjoint,
or just overwrite the contents of the previous one.
Combine two ` EnvMBE ` s whose names ( both environment names and repeat names ) are disjoint or just overwrite the contents of the previous one .
&self
rhs
&EnvMBE<T>