@@ -273,21 +273,19 @@ where
273
273
}
274
274
275
275
/// The legal operations for a transfer function in a gen/kill problem.
276
- pub trait GenKill < T > : Sized {
277
- /// Inserts `elem` into the `gen` set, removing it the `kill` set if present .
276
+ pub trait GenKill < T > {
277
+ /// Inserts `elem` into the state vector .
278
278
fn gen ( & mut self , elem : T ) ;
279
279
280
- /// Inserts `elem` into the `kill` set, removing it the `gen` set if present .
280
+ /// Removes `elem` from the state vector .
281
281
fn kill ( & mut self , elem : T ) ;
282
282
283
- /// Inserts the given elements into the `gen` set, removing them from the `kill` set if present.
284
283
fn gen_all ( & mut self , elems : impl IntoIterator < Item = T > ) {
285
284
for elem in elems {
286
285
self . gen ( elem) ;
287
286
}
288
287
}
289
288
290
- /// Inserts the given elements into the `kill` set, removing them from the `gen` set if present.
291
289
fn kill_all ( & mut self , elems : impl IntoIterator < Item = T > ) {
292
290
for elem in elems {
293
291
self . kill ( elem) ;
@@ -296,6 +294,10 @@ pub trait GenKill<T>: Sized {
296
294
}
297
295
298
296
/// Stores a transfer function for a gen/kill problem.
297
+ ///
298
+ /// Calling `gen`/`kill` on a `GenKillSet` will "build up" a transfer function so that it can be
299
+ /// applied to a state vector efficiently. When there are multiple calls to `gen` and/or `kill` for
300
+ /// the same element, the most recent one takes precedence.
299
301
#[ derive( Clone ) ]
300
302
pub struct GenKillSet < T : Idx > {
301
303
gen : HybridBitSet < T > ,
@@ -311,7 +313,7 @@ impl<T: Idx> GenKillSet<T> {
311
313
}
312
314
}
313
315
314
- /// Applies this transfer function to the given bitset .
316
+ /// Applies this transfer function to the given state vector .
315
317
pub fn apply ( & self , state : & mut BitSet < T > ) {
316
318
state. union ( & self . gen ) ;
317
319
state. subtract ( & self . kill ) ;
0 commit comments