From 14657bf4a9b9d64f9c25eed9c20200c0927c1d70 Mon Sep 17 00:00:00 2001 From: Justin Aquadro Date: Sun, 9 Oct 2011 00:13:30 -0400 Subject: [PATCH] Convenience functions to NBT list tag type --- SubstrateCS/Source/Nbt/TagNodeList.cs | 36 +++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/SubstrateCS/Source/Nbt/TagNodeList.cs b/SubstrateCS/Source/Nbt/TagNodeList.cs index 8cbc01e..c2dc021 100644 --- a/SubstrateCS/Source/Nbt/TagNodeList.cs +++ b/SubstrateCS/Source/Nbt/TagNodeList.cs @@ -84,6 +84,16 @@ namespace Substrate.Nbt return list; } + /// + /// Finds the first subnode that matches the conditions defined by the specified predicate. + /// + /// The delegate that defines the conditions of the subnode to search for. + /// The first subnode matching the predicate. + public TagNode Find (Predicate match) + { + return _items.Find(match); + } + /// /// Retrieves all the subnodes that match the conditions defined by the specified predicate. /// @@ -104,6 +114,32 @@ namespace Substrate.Nbt return _items.RemoveAll(match); } + /// + /// Reverses the order of all the subnodes in the list. + /// + public void Reverse () + { + _items.Reverse(); + } + + /// + /// Reverse the order of subnodes in the specified range. + /// + /// The zero-based starting index of the subnodes to reverse + /// The number of subnodes in the range to reverse. + public void Reverse (int index, int count) + { + _items.Reverse(index, count); + } + + /// + /// Sorts all the subnodes in the list using the default comparator + /// + public void Sort () + { + _items.Sort(); + } + /// /// Gets a string representation of the node's data. ///