// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System.Collections.Generic; using System.Linq; namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing.Colour.Data { /// /// Encodes a list of s. /// s with the same are grouped together. /// public class AlternatingMonoPattern { /// /// s that are grouped together within this . /// public readonly List MonoStreaks = new List(); /// /// The parent that contains this /// public RepeatingHitPatterns Parent = null!; /// /// Index of this within it's parent /// public int Index; /// /// The first in this . /// public TaikoDifficultyHitObject FirstHitObject => MonoStreaks[0].FirstHitObject; /// /// All s in this . /// public IEnumerable AllHitObjects => MonoStreaks.SelectMany(streak => streak.HitObjects); /// /// Determine if this is a repetition of another . This /// is a strict comparison and is true if and only if the colour sequence is exactly the same. /// public bool IsRepetitionOf(AlternatingMonoPattern other) { return HasIdenticalMonoLength(other) && other.MonoStreaks.Count == MonoStreaks.Count && other.MonoStreaks[0].HitType == MonoStreaks[0].HitType; } /// /// Determine if this has the same mono length of another . /// public bool HasIdenticalMonoLength(AlternatingMonoPattern other) { return other.MonoStreaks[0].RunLength == MonoStreaks[0].RunLength; } } }