[Roam-commit] SF.net SVN: roam: [104] Trunk/Source
Status: Alpha
Brought to you by:
jonfroehlich
|
From: <jon...@us...> - 2007-11-08 18:07:41
|
Revision: 104
http://roam.svn.sourceforge.net/roam/?rev=104&view=rev
Author: jonfroehlich
Date: 2007-11-08 10:07:38 -0800 (Thu, 08 Nov 2007)
Log Message:
-----------
added CountNumberOfCommonStrings method to StringUtils
Modified Paths:
--------------
Trunk/Source/Roam.Common/Utils/StringUtils.cs
Trunk/Source/Roam.Test/Roam.Test.csproj
Modified: Trunk/Source/Roam.Common/Utils/StringUtils.cs
===================================================================
--- Trunk/Source/Roam.Common/Utils/StringUtils.cs 2007-11-05 16:45:36 UTC (rev 103)
+++ Trunk/Source/Roam.Common/Utils/StringUtils.cs 2007-11-08 18:07:38 UTC (rev 104)
@@ -16,6 +16,7 @@
using System.Text;
using System.Collections;
using System.Collections.Generic;
+using Roam.Common.Collections;
namespace Roam.Common.Utils
{
@@ -108,5 +109,20 @@
{
return s.IndexOf(value) != -1;
}
+
+ /// <summary>
+ /// For this method to work correctly, neither string collection can have duplicate strings within
+ /// its own collection.
+ /// </summary>
+ /// <param name="stringsA"></param>
+ /// <param name="stringsB"></param>
+ /// <returns></returns>
+ public static int CountNumberOfCommonStrings(ICollection<string> stringsA, ICollection<string> stringsB)
+ {
+ HashSet<string> setUniqueStrings = new HashSet<string>();
+ foreach (string s in stringsA) { setUniqueStrings.Add(s); }
+ foreach (string s in stringsB) { setUniqueStrings.Add(s); }
+ return stringsA.Count + stringsB.Count - setUniqueStrings.Count;
+ }
}
}
Modified: Trunk/Source/Roam.Test/Roam.Test.csproj
===================================================================
--- Trunk/Source/Roam.Test/Roam.Test.csproj 2007-11-05 16:45:36 UTC (rev 103)
+++ Trunk/Source/Roam.Test/Roam.Test.csproj 2007-11-08 18:07:38 UTC (rev 104)
@@ -560,7 +560,7 @@
<DependentUpon>TextBoxFilteredListTest.cs</DependentUpon>
</Compile>
<Compile Include="UI\Controls\FontTest.cs">
- <SubType>Form</SubType>
+ <SubType>Component</SubType>
</Compile>
<Compile Include="UI\Controls\FontTest.Designer.cs">
<DependentUpon>FontTest.cs</DependentUpon>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|