// Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Framework.Extensions.IEnumerableExtensions; using osu.Game.Rulesets.Mania.Objects; using System.Collections.Generic; using System.Linq; namespace osu.Game.Rulesets.Mania.Beatmaps { internal class ObjectList { private readonly List hitObjects = new List(); /// /// All the hit objects contained in this list. /// public IEnumerable HitObjects => hitObjects; /// /// Whether a column of this list has been taken. /// /// The column index. /// Whether the column already contains a hit object. public bool IsFilled(int column) => hitObjects.Exists(h => h.Column == column); /// /// Amount of columns taken up by hit objects in this list. /// public int ColumnsFilled => HitObjects.GroupBy(h => h.Column).Count(); /// /// Adds a hit object to this list. /// /// The hit object to add. public void Add(ManiaHitObject hitObject) => hitObjects.Add(hitObject); /// /// Copies hit object from another list to this one. /// /// The other list. public void Add(ObjectList other) { other.HitObjects.ForEach(Add); } /// /// Clears this list. /// public void Clear() => hitObjects.Clear(); /// /// Removes a hit object from this list. /// /// The hit object to remove. public bool Remove(ManiaHitObject hitObject) => hitObjects.Remove(hitObject); } }