Add utility methods for copying time transition maps and filtering grace periods

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=130281141
This commit is contained in:
mountford 2016-08-15 08:03:29 -07:00 committed by Ben McIlwain
parent 19da9a1531
commit 57ec8b3ae3
2 changed files with 42 additions and 0 deletions

View file

@ -125,6 +125,17 @@ public class TimedTransitionProperty<V, T extends TimedTransitionProperty.TimedT
makeTransitionMap(valueMap, timedTransitionSubclass)));
}
/**
* Returns a new immutable {@code TimedTransitionProperty} containing the same transitions as the
* current object, up to but not including the desired date. All transitions on or after that date
* will be deleted.
*
* @param asOfDate the date before which transitions should be retained
*/
public TimedTransitionProperty<V, T> copyUntilJustBefore(DateTime asOfDate) {
return new TimedTransitionProperty<>(backingMap.headMap(asOfDate, false));
}
/**
* Returns a new mutable {@code TimedTransitionProperty} representing the given map of DateTime
* to value, with transitions constructed using the given {@code TimedTransition} subclass.