refactor!: renamed gradual calc types

This commit is contained in:
MaxOhn
2023-11-08 21:47:54 +01:00
parent 06a76a834e
commit 1434e88cef
28 changed files with 168 additions and 167 deletions
+6 -6
View File
@@ -24,12 +24,12 @@ use super::{
/// Note that it does not return attributes after a tiny droplet. Only for fruits and droplets.
///
/// If you want to calculate performance attributes, use
/// [`CatchGradualPerformanceAttributes`](crate::catch::CatchGradualPerformanceAttributes) instead.
/// [`CatchGradualPerformanceAttributes`](crate::catch::CatchGradualPerformance) instead.
///
/// # Example
///
/// ```
/// use rosu_pp::{Beatmap, catch::CatchGradualDifficultyAttributes};
/// use rosu_pp::{Beatmap, catch::CatchGradualDifficulty};
///
/// # /*
/// let map: Beatmap = ...
@@ -37,7 +37,7 @@ use super::{
/// # let map = Beatmap::default();
///
/// let mods = 64; // DT
/// let mut iter = CatchGradualDifficultyAttributes::new(&map, mods);
/// let mut iter = CatchGradualDifficulty::new(&map, mods);
///
/// let attrs1 = iter.next(); // the difficulty of the map after the first hit object
/// let attrs2 = iter.next(); // after the second hit object
@@ -48,7 +48,7 @@ use super::{
/// }
/// ```
#[derive(Clone, Debug)]
pub struct CatchGradualDifficultyAttributes<'map> {
pub struct CatchGradualDifficulty<'map> {
pub(crate) idx: usize,
clock_rate: f64,
hit_objects: CatchObjectIter<'map>,
@@ -61,7 +61,7 @@ pub struct CatchGradualDifficultyAttributes<'map> {
strain_peak_buf: Vec<f64>,
}
impl<'map> CatchGradualDifficultyAttributes<'map> {
impl<'map> CatchGradualDifficulty<'map> {
/// Create a new difficulty attributes iterator for osu!catch maps.
pub fn new(map: &'map Beatmap, mods: u32) -> Self {
let map_attributes = map.attributes().mods(mods).build();
@@ -105,7 +105,7 @@ impl<'map> CatchGradualDifficultyAttributes<'map> {
}
}
impl Iterator for CatchGradualDifficultyAttributes<'_> {
impl Iterator for CatchGradualDifficulty<'_> {
type Item = CatchDifficultyAttributes;
fn next(&mut self) -> Option<Self::Item> {
+8 -8
View File
@@ -1,6 +1,6 @@
use crate::{Beatmap, CatchPP};
use super::{CatchGradualDifficultyAttributes, CatchPerformanceAttributes, CatchScoreState};
use super::{CatchGradualDifficulty, CatchPerformanceAttributes, CatchScoreState};
/// Gradually calculate the performance attributes of an osu!catch map.
///
@@ -17,12 +17,12 @@ use super::{CatchGradualDifficultyAttributes, CatchPerformanceAttributes, CatchS
/// to be processed. Only fruits and droplets do.
///
/// If you only want to calculate difficulty attributes use
/// [`CatchGradualDifficultyAttributes`](crate::catch::CatchGradualDifficultyAttributes) instead.
/// [`CatchGradualDifficultyAttributes`](crate::catch::CatchGradualDifficulty) instead.
///
/// # Example
///
/// ```
/// use rosu_pp::{Beatmap, catch::{CatchGradualPerformanceAttributes, CatchScoreState}};
/// use rosu_pp::{Beatmap, catch::{CatchGradualPerformance, CatchScoreState}};
///
/// # /*
/// let map: Beatmap = ...
@@ -30,7 +30,7 @@ use super::{CatchGradualDifficultyAttributes, CatchPerformanceAttributes, CatchS
/// # let map = Beatmap::default();
///
/// let mods = 64; // DT
/// let mut gradual_perf = CatchGradualPerformanceAttributes::new(&map, mods);
/// let mut gradual_perf = CatchGradualPerformance::new(&map, mods);
/// let mut state = CatchScoreState::new(); // empty state, everything is on 0.
///
/// // The first 10 hitresults are only fruits
@@ -96,15 +96,15 @@ use super::{CatchGradualDifficultyAttributes, CatchPerformanceAttributes, CatchS
/// assert!(gradual_perf.next(state).is_none());
/// ```
#[derive(Clone, Debug)]
pub struct CatchGradualPerformanceAttributes<'map> {
difficulty: CatchGradualDifficultyAttributes<'map>,
pub struct CatchGradualPerformance<'map> {
difficulty: CatchGradualDifficulty<'map>,
performance: CatchPP<'map>,
}
impl<'map> CatchGradualPerformanceAttributes<'map> {
impl<'map> CatchGradualPerformance<'map> {
/// Create a new gradual performance calculator for osu!standard maps.
pub fn new(map: &'map Beatmap, mods: u32) -> Self {
let difficulty = CatchGradualDifficultyAttributes::new(map, mods);
let difficulty = CatchGradualDifficulty::new(map, mods);
let performance = CatchPP::new(map).mods(mods).passed_objects(0);
Self {
+2 -3
View File
@@ -17,8 +17,7 @@ pub use self::{catch_object::CatchObject, pp::*, score_state::CatchScoreState};
#[cfg(feature = "gradual")]
pub use self::{
gradual_difficulty::CatchGradualDifficultyAttributes,
gradual_performance::CatchGradualPerformanceAttributes,
gradual_difficulty::CatchGradualDifficulty, gradual_performance::CatchGradualPerformance,
};
pub(crate) use self::fruit_or_juice::{FruitOrJuice, FruitParams};
@@ -83,7 +82,7 @@ impl<'map> CatchStars<'map> {
///
/// If you want to calculate the difficulty after every few objects, instead of
/// using [`CatchStars`] multiple times with different `passed_objects`, you should use
/// [`CatchGradualDifficultyAttributes`](crate::catch::CatchGradualDifficultyAttributes).
/// [`CatchGradualDifficultyAttributes`](crate::catch::CatchGradualDifficulty).
#[inline]
pub fn passed_objects(mut self, passed_objects: usize) -> Self {
self.passed_objects = Some(passed_objects);
+1 -1
View File
@@ -141,7 +141,7 @@ impl<'map> CatchPP<'map> {
///
/// If you want to calculate the performance after every few objects, instead of
/// using [`CatchPP`] multiple times with different `passed_objects`, you should use
/// [`CatchGradualPerformanceAttributes`](crate::catch::CatchGradualPerformanceAttributes).
/// [`CatchGradualPerformanceAttributes`](crate::catch::CatchGradualPerformance).
#[inline]
pub fn passed_objects(mut self, passed_objects: usize) -> Self {
self.passed_objects.replace(passed_objects);