From ff58730fe0cdab1064b00f3c0eb95433d67d15db Mon Sep 17 00:00:00 2001 From: Alex Lementuev Date: Tue, 20 Dec 2016 10:28:23 -0800 Subject: [PATCH] Refactoring --- .../Console/CConsoleFilteredDelegate.cs | 12 ++++----- .../Editor/Console/ICConsoleViewFilter.cs | 20 +++++++------- .../ConsoleViewTest.Filtering.cs | 26 +++++++++---------- 3 files changed, 29 insertions(+), 29 deletions(-) diff --git a/Project/Assets/LunarPlugin/Editor/Console/CConsoleFilteredDelegate.cs b/Project/Assets/LunarPlugin/Editor/Console/CConsoleFilteredDelegate.cs index 34dccfb..f782956 100644 --- a/Project/Assets/LunarPlugin/Editor/Console/CConsoleFilteredDelegate.cs +++ b/Project/Assets/LunarPlugin/Editor/Console/CConsoleFilteredDelegate.cs @@ -28,7 +28,7 @@ namespace LunarEditor { - class CConsoleFilteredDelegate : ConsoleViewCompositeFilter, ITableViewDataSource, ITableViewDelegate, ICConsoleDelegate + class CConsoleFilteredDelegate : CConsoleViewCompositeFilter, ITableViewDataSource, ITableViewDelegate, ICConsoleDelegate { private CConsoleView m_consoleView; @@ -201,7 +201,7 @@ public bool SetFilterText(string filterText) return false; } - private bool ApplyFilter(IConsoleViewFilter filter) + private bool ApplyFilter(ICConsoleViewFilter filter) { int oldIndicesCount = m_filteredIndices.RealLength; ClearIndices(); @@ -223,7 +223,7 @@ private bool ApplyFilter(IConsoleViewFilter filter) m_filteredIndices.RealLength != Entries.RealLength; } - private bool AppendFilter(IConsoleViewFilter filter) + private bool AppendFilter(ICConsoleViewFilter filter) { CConsoleViewCellEntry[] entriesArray = Entries.InternalArray; int toIndex = m_filteredIndices.HeadIndex; @@ -349,7 +349,7 @@ private CCycleArray Entries #endregion } - class CConsoleViewTextFilter : ConsoleViewFilterBase + class CConsoleViewTextFilter : CConsoleViewFilterBase { private string m_text; @@ -378,7 +378,7 @@ public string Text } } - class CConsoleViewTagFilter : ConsoleViewFilterBase + class CConsoleViewTagFilter : CConsoleViewFilterBase { private HashSet m_tags; @@ -431,7 +431,7 @@ public bool HasTags } } - class CConsoleViewLogLevelFilter : ConsoleViewFilterBase + class CConsoleViewLogLevelFilter : CConsoleViewFilterBase { private CLogLevel m_level; diff --git a/Project/Assets/LunarPlugin/Editor/Console/ICConsoleViewFilter.cs b/Project/Assets/LunarPlugin/Editor/Console/ICConsoleViewFilter.cs index 0aee1a6..763bcf3 100644 --- a/Project/Assets/LunarPlugin/Editor/Console/ICConsoleViewFilter.cs +++ b/Project/Assets/LunarPlugin/Editor/Console/ICConsoleViewFilter.cs @@ -25,16 +25,16 @@ namespace LunarEditor { - interface IConsoleViewFilter + interface ICConsoleViewFilter { bool Apply(ref CConsoleViewCellEntry entry); } - abstract class ConsoleViewFilterBase : IConsoleViewFilter + abstract class CConsoleViewFilterBase : ICConsoleViewFilter { private int m_priority; - public ConsoleViewFilterBase(int priority = int.MinValue) + public CConsoleViewFilterBase(int priority = int.MinValue) { m_priority = priority; } @@ -47,13 +47,13 @@ public int Priority } } - class ConsoleViewCompositeFilter : IConsoleViewFilter + class CConsoleViewCompositeFilter : ICConsoleViewFilter { - private List m_filters; + private List m_filters; - public ConsoleViewCompositeFilter() + public CConsoleViewCompositeFilter() { - m_filters = new List(); + m_filters = new List(); } #region IConsoleViewFilter implementation @@ -75,7 +75,7 @@ public bool Apply(ref CConsoleViewCellEntry entry) #region Filters - public void AddFilter(ConsoleViewFilterBase filter) + public void AddFilter(CConsoleViewFilterBase filter) { if (filter == null) { @@ -84,7 +84,7 @@ public void AddFilter(ConsoleViewFilterBase filter) for (int i = 0; i < m_filters.Count; ++i) { - ConsoleViewFilterBase f = m_filters[i]; + CConsoleViewFilterBase f = m_filters[i]; if (f.Priority < filter.Priority) { m_filters.Insert(i, filter); @@ -100,7 +100,7 @@ public void AddFilter(ConsoleViewFilterBase filter) m_filters.Add(filter); } - public void RemoveFilter(ConsoleViewFilterBase filter) + public void RemoveFilter(CConsoleViewFilterBase filter) { m_filters.Remove(filter); } diff --git a/Test/Test/ConsoleViewTests/ConsoleViewTest.Filtering.cs b/Test/Test/ConsoleViewTests/ConsoleViewTest.Filtering.cs index 33258d6..b4a1824 100644 --- a/Test/Test/ConsoleViewTests/ConsoleViewTest.Filtering.cs +++ b/Test/Test/ConsoleViewTests/ConsoleViewTest.Filtering.cs @@ -22,25 +22,25 @@ public void TestFilterPriority() { List priorities = new List(); - ConsoleViewFilterBase filter1 = new TestFilter(1, delegate(ref CConsoleViewCellEntry e) + CConsoleViewFilterBase filter1 = new TestFilter(1, delegate(ref CConsoleViewCellEntry e) { priorities.Add(1); return true; }); - ConsoleViewFilterBase filter2 = new TestFilter(2, delegate(ref CConsoleViewCellEntry e) + CConsoleViewFilterBase filter2 = new TestFilter(2, delegate(ref CConsoleViewCellEntry e) { priorities.Add(2); return true; }); - ConsoleViewFilterBase filter3 = new TestFilter(3, delegate(ref CConsoleViewCellEntry e) + CConsoleViewFilterBase filter3 = new TestFilter(3, delegate(ref CConsoleViewCellEntry e) { priorities.Add(3); return true; }); - ConsoleViewCompositeFilter compositeFilter = new ConsoleViewCompositeFilter(); + CConsoleViewCompositeFilter compositeFilter = new CConsoleViewCompositeFilter(); compositeFilter.AddFilter(filter2); compositeFilter.AddFilter(filter1); compositeFilter.AddFilter(filter3); @@ -59,25 +59,25 @@ public void TestCompositeFilterApply() { List priorities = new List(); - ConsoleViewFilterBase filter1 = new TestFilter(1, delegate(ref CConsoleViewCellEntry e) + CConsoleViewFilterBase filter1 = new TestFilter(1, delegate(ref CConsoleViewCellEntry e) { priorities.Add(1); return true; }); - ConsoleViewFilterBase filter2 = new TestFilter(2, delegate(ref CConsoleViewCellEntry e) + CConsoleViewFilterBase filter2 = new TestFilter(2, delegate(ref CConsoleViewCellEntry e) { priorities.Add(2); return false; }); - ConsoleViewFilterBase filter3 = new TestFilter(3, delegate(ref CConsoleViewCellEntry e) + CConsoleViewFilterBase filter3 = new TestFilter(3, delegate(ref CConsoleViewCellEntry e) { priorities.Add(3); return true; }); - ConsoleViewCompositeFilter compositeFilter = new ConsoleViewCompositeFilter(); + CConsoleViewCompositeFilter compositeFilter = new CConsoleViewCompositeFilter(); compositeFilter.AddFilter(filter2); compositeFilter.AddFilter(filter1); compositeFilter.AddFilter(filter3); @@ -96,25 +96,25 @@ public void TestCompositeFilterRemove() { List priorities = new List(); - ConsoleViewFilterBase filter1 = new TestFilter(1, delegate(ref CConsoleViewCellEntry e) + CConsoleViewFilterBase filter1 = new TestFilter(1, delegate(ref CConsoleViewCellEntry e) { priorities.Add(1); return true; }); - ConsoleViewFilterBase filter2 = new TestFilter(2, delegate(ref CConsoleViewCellEntry e) + CConsoleViewFilterBase filter2 = new TestFilter(2, delegate(ref CConsoleViewCellEntry e) { priorities.Add(2); return true; }); - ConsoleViewFilterBase filter3 = new TestFilter(3, delegate(ref CConsoleViewCellEntry e) + CConsoleViewFilterBase filter3 = new TestFilter(3, delegate(ref CConsoleViewCellEntry e) { priorities.Add(3); return true; }); - ConsoleViewCompositeFilter compositeFilter = new ConsoleViewCompositeFilter(); + CConsoleViewCompositeFilter compositeFilter = new CConsoleViewCompositeFilter(); compositeFilter.AddFilter(filter1); compositeFilter.AddFilter(filter2); compositeFilter.AddFilter(filter3); @@ -905,7 +905,7 @@ public void TestMixedFiltersTagLevelText() delegate bool TestFilterDelegate(ref CConsoleViewCellEntry entry); - class TestFilter : ConsoleViewFilterBase + class TestFilter : CConsoleViewFilterBase { private TestFilterDelegate m_delegate;