You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucenenet.apache.org by mh...@apache.org on 2011/08/12 23:00:57 UTC
[Lucene.Net] svn commit: r1157250 [3/4] - in
/incubator/lucene.net/branches/Lucene.Net_4e: ./ build/scripts/ packages/
packages/PortableLibrary/ src/Lucene.Net.TestFramework/
src/Lucene.Net.TestFramework/Extensions/NUnit/
src/Lucene.Net.TestFramework/Properties/ sr...
Added: incubator/lucene.net/branches/Lucene.Net_4e/build/scripts/CustomDictionary.xml
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_4e/build/scripts/CustomDictionary.xml?rev=1157250&view=auto
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_4e/build/scripts/CustomDictionary.xml (added)
+++ incubator/lucene.net/branches/Lucene.Net_4e/build/scripts/CustomDictionary.xml Fri Aug 12 21:00:55 2011
@@ -0,0 +1,9 @@
+<Dictionary>
+ <Words>
+ <Recognized>
+ <Word>Lucene</Word>
+ <Word>Util</Word>
+ </Recognized>
+ </Words>
+
+<Dictionary>
\ No newline at end of file
Modified: incubator/lucene.net/branches/Lucene.Net_4e/build/scripts/build.targets
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_4e/build/scripts/build.targets?rev=1157250&r1=1157249&r2=1157250&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_4e/build/scripts/build.targets (original)
+++ incubator/lucene.net/branches/Lucene.Net_4e/build/scripts/build.targets Fri Aug 12 21:00:55 2011
@@ -41,10 +41,6 @@
<PackagesFolder>$(RootFolder)\packages</PackagesFolder>
</PropertyGroup>
-
-
-
-
<!-- To Execute commands on mono like running nunit, it requires running through the program mono.exe -->
<PropertyGroup Condition="'$(NETFRAMEWORK)' == 'mono'">
<Executable>mono</Executable>
@@ -81,7 +77,21 @@
<Message Text="Project Files: @(ProjectFiles)" />
<MSBuild Projects="@(ProjectFiles)" Properties="Configuration=$(Configuration)" />
</Target>
+
+ <Target Name="copy-release">
+ <MakeDir Condition="!Exists('$(RootFolder)\bin')" Directories="$(RootFolder)\bin" />
+ <Copy SourceFiles="@(ReleaseFiles)" DestinationFolder="$(RootFolder)\bin" />
+ </Target>
+
+ <Target Name="nightly">
+ <CallTarget Targets="commit" />
+ </Target>
+ <Target Name="commit">
+ <CallTarget Targets="clean;build;test-report-html;rules;coverage;document;copy-release" />
+ </Target>
+
+
<Import Condition="'$(NETFRAMEWORK)' != 'mono'" Project="dot-net-tools.targets" />
<Import Condition="'$(NETFRAMEWORK)' == 'mono'" Project="mono-tools.targets" />
</Project>
\ No newline at end of file
Modified: incubator/lucene.net/branches/Lucene.Net_4e/build/scripts/core.targets
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_4e/build/scripts/core.targets?rev=1157250&r1=1157249&r2=1157250&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_4e/build/scripts/core.targets (original)
+++ incubator/lucene.net/branches/Lucene.Net_4e/build/scripts/core.targets Fri Aug 12 21:00:55 2011
@@ -43,9 +43,21 @@
<!-- Assemblies To Test -->
<TestFiles Include="$(CoreBinFolder)\*.Test.dll" />
- <!-- Rules for code to follow -->
- <AnalysisFiles Include="$(CoreBinFolder)\Lucene.Net.dll" />
- <AnalysisFiles Include="$(CoreBinFolder)\Lucene.Net.TestFramework.dll" />
+ <!-- Files To Release -->
+ <ReleaseFiles Include="$(CoreBinFolder)\Lucene.Net.dll" />
+ <ReleaseFiles Include="$(CoreBinFolder)\Lucene.Net.XML" />
+ <ReleaseFiles Include="$(CoreBinFolder)\Lucene.Net.TestFramework.dll" />
+ <ReleaseFiles Include="$(CoreBinFolder)\Lucene.Net.TestFramework.XML" />
+
+ <ReferenceFiles Include="$(PackagesFolder)\PortableLibrary\System.Core.dll" />
+ <ReferenceFiles Include="$(PackagesFolder)\PortableLibrary\mscorlib.dll" />
+ <ReferenceFiles Include="$(PackagesFolder)\PortableLibrary\System.dll" />
+ <ReferenceFiles Include="$(PackagesFolder)\PortableLibrary\System.Net.dll" />
+ <ReferenceFiles Include="$(PackagesFolder)\PortableLibrary\System.Xml.dll" />
+ <ReferenceFiles Include="$(PackagesFolder)\PortableLibrary\mscorlib.dll" />
+ <!--
+ <AnalysisFiles Include="$(CoreBinFolder)\Lucene.Net.dll" /> -->
+
<PathTargets Include="paths-lucene" />
</ItemGroup>
Modified: incubator/lucene.net/branches/Lucene.Net_4e/build/scripts/documentation.shfbproj
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_4e/build/scripts/documentation.shfbproj?rev=1157250&r1=1157249&r2=1157250&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_4e/build/scripts/documentation.shfbproj (original)
+++ incubator/lucene.net/branches/Lucene.Net_4e/build/scripts/documentation.shfbproj Fri Aug 12 21:00:55 2011
@@ -29,6 +29,7 @@
<WorkingPath>..\artifacts\working\</WorkingPath>
<HelpFileFormat>HtmlHelp1, Website</HelpFileFormat>
<HelpTitle>Lucene.Net Class Library</HelpTitle>
+ <BinaryTOC>False</BinaryTOC>
</PropertyGroup>
<!-- There are no properties for these groups. AnyCPU needs to appear in
order for Visual Studio to perform the build. The others are optional
@@ -50,9 +51,21 @@
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|Win32' ">
</PropertyGroup>
<ItemGroup>
- <Reference Include="System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
- <Reference Include="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
- <Reference Include="System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
+ <Reference Include="mscorlib">
+ <HintPath>..\..\packages\PortableLibrary\mscorlib.dll</HintPath>
+ </Reference>
+ <Reference Include="System">
+ <HintPath>..\..\packages\PortableLibrary\System.dll</HintPath>
+ </Reference>
+ <Reference Include="System.Core">
+ <HintPath>..\..\packages\PortableLibrary\System.Core.dll</HintPath>
+ </Reference>
+ <Reference Include="System.Net">
+ <HintPath>..\..\packages\PortableLibrary\System.Net.dll</HintPath>
+ </Reference>
+ <Reference Include="System.Xml">
+ <HintPath>..\..\packages\PortableLibrary\System.Xml.dll</HintPath>
+ </Reference>
</ItemGroup>
<!-- Import the SHFB build targets -->
<Import Project="$(SHFBROOT)\SandcastleHelpFileBuilder.targets" />
Modified: incubator/lucene.net/branches/Lucene.Net_4e/build/scripts/dot-net-tools.targets
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_4e/build/scripts/dot-net-tools.targets?rev=1157250&r1=1157249&r2=1157250&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_4e/build/scripts/dot-net-tools.targets (original)
+++ incubator/lucene.net/branches/Lucene.Net_4e/build/scripts/dot-net-tools.targets Fri Aug 12 21:00:55 2011
@@ -39,13 +39,16 @@
<FxCopFolder Include="$(ProgramFiles32)\Microsoft Fxcop 10.0" />
<NCoverFolder Include="$(ProgramFiles)\NCover" />
<GallioFolder Include="$(PackagesFolder)\$(GallioVersionFolder)\tools\" />
- <FxCopCommands Include="@(RuleFiles-> '/file:%(rootdir)%(directory)%(filename)%(extension)')" />
+ <FxCopCommands Include="@(AnalysisFiles-> ' /file:%(rootdir)%(directory)%(filename)%(extension)', ' ')" />
+ <FxCopReferences Include="@(ReferenceFiles-> ' /reference:%(rootdir)%(directory)%(filename)%(extension)', ' ')" />
<SHFBFolder Include="$(ProgramFiles32)\EWSoftware\Sand Castle Help File Builder" />
<SandCastleFolder Include="C:\Program Files (x86)\Sandcastle" />
<CleanFiles Include="$(ArtifactsFolder)\ncover\*.*" />
<CleanFiles Include="$(ArtifactsFolder)\html-test-reports\*.*" />
<CleanFiles Include="$(ArtifactsFolder)\xml-test-reports\*.*" />
<CleanFiles Include="$(ArtifactsFolder)\docs\*.*" />
+ <CoverageFiles Include="$(PackagesFolder)\PortableLibrary\*.*" />
+ <ReleaseFiles Include="$(ArtifactsFolder)\docs\Lucene.Net.chm" />
</ItemGroup>
@@ -71,7 +74,7 @@
<Target Name="test-report-xml" DependsOnTargets="build">
<MakeDir Condition="!Exists('$(TEMP)')" Directories="$(TEMP)" />
-
+ <Copy SourceFiles="@(Compile)" DestinationFolder="c:\foocopy\%(RecursiveDir)"></Copy>
<Exec Condition="Exists('%(GallioFolder.FullPath)')" Command="%(GallioFolder.FullPath)Gallio.Echo.exe @(TestFiles) /hd:$(PackagesFolder)\$(NUnitVersionFolder)\tools\ /nl /rd:$(ArtifactsFolder)\xml-test-reports /rt:Xml /rnf:test-reports" />
@@ -113,7 +116,7 @@
<Target Name="document" DependsOnTargets="build">
-
+ <Copy SourceFiles="@(CoverageFiles)" DestinationFolder="$(BinFolder)\core\$(Configuration)" />
<MSBuild
Condition="Exists('%(SandCastleFolder.FullPath)')"
Projects="$(BuildFolder)\scripts\documentation.shfbproj"
@@ -145,7 +148,9 @@
</Target>
<Target Name="rules" DependsOnTargets="build">
- <Exec Condition="Exists('%(FxCopFolder.FullPath)')" Command='"%(FxCopFolder.FullPath)\FxCopCmd.exe" @(FxCopCommands) /project:$(RootFolder)build\scripts\rules.fxcop /out:$(ArtifactsFolder)\fxcop.xml ' />
+ <Exec Condition="Exists('%(FxCopFolder.FullPath)')" Command='"%(FxCopFolder.FullPath)\FxCopCmd.exe" @(FxCopCommands) @(FxCopReferences) /project:$(RootFolder)build\scripts\rules.fxcop /out:$(ArtifactsFolder)\fxcop.xml ' ContinueOnError="true">
+ <Output TaskParameter="ExitCode" PropertyName="ErrorCode"/>
+ </Exec>
<!-- Notify user if fxcop is not found -->
<Warning
Modified: incubator/lucene.net/branches/Lucene.Net_4e/build/scripts/rules.fxcop
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_4e/build/scripts/rules.fxcop?rev=1157250&r1=1157249&r2=1157250&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_4e/build/scripts/rules.fxcop (original)
+++ incubator/lucene.net/branches/Lucene.Net_4e/build/scripts/rules.fxcop Fri Aug 12 21:00:55 2011
@@ -4,26 +4,100 @@
<SharedProject>True</SharedProject>
<Stylesheet Apply="False">$(FxCopDir)\Xml\FxCopReport.xsl</Stylesheet>
<SaveMessages>
- <Project Status="Active, Excluded, Good, Noise" NewOnly="False" />
- <Report Status="Active, Good, Noise" NewOnly="False" />
+ <Project Status="Active, Excluded" NewOnly="False" />
+ <Report Status="Active" NewOnly="False" />
</SaveMessages>
<ProjectFile Compress="True" DefaultTargetCheck="True" DefaultRuleCheck="True" SaveByRuleGroup="" Deterministic="True" />
<EnableMultithreadedLoad>True</EnableMultithreadedLoad>
<EnableMultithreadedAnalysis>True</EnableMultithreadedAnalysis>
<SourceLookup>True</SourceLookup>
- <AnalysisExceptionsThreshold>10</AnalysisExceptionsThreshold>
- <RuleExceptionsThreshold>1</RuleExceptionsThreshold>
+ <AnalysisExceptionsThreshold>40</AnalysisExceptionsThreshold>
+ <RuleExceptionsThreshold>40</RuleExceptionsThreshold>
<Spelling Locale="en-US" />
<OverrideRuleVisibilities>False</OverrideRuleVisibilities>
<CustomDictionaries SearchFxCopDir="True" SearchUserProfile="True" SearchProjectDir="True" />
<SearchGlobalAssemblyCache>False</SearchGlobalAssemblyCache>
<DeadlockDetectionTimeout>120</DeadlockDetectionTimeout>
- <IgnoreGeneratedCode>False</IgnoreGeneratedCode>
+ <IgnoreGeneratedCode>True</IgnoreGeneratedCode>
</ProjectOptions>
- <Targets />
+ <Targets>
+ <AssemblyReferenceDirectories>
+ <Directory>$(ProjectDir)/../../PortableLibrary/</Directory>
+ </AssemblyReferenceDirectories>
+ <Target Name="$(ProjectDir)/../bin/core/Debug/Lucene.Net.dll" Analyze="True" AnalyzeAllChildren="True" />
+ <Target Name="$(ProjectDir)/../../packages/PortableLibrary/mscorlib.dll" Analyze="False" AnalyzeAllChildren="False" />
+ <Target Name="$(ProjectDir)/../../packages/PortableLibrary/System.Core.dll" Analyze="False" AnalyzeAllChildren="False" />
+ <Target Name="$(ProjectDir)/../../packages/PortableLibrary/System.dll" Analyze="False" AnalyzeAllChildren="False" />
+ <Target Name="$(ProjectDir)/../../packages/PortableLibrary/System.Net.dll" Analyze="False" AnalyzeAllChildren="False" />
+ <Target Name="$(ProjectDir)/../../packages/PortableLibrary/System.Runtime.Serialization.dll" Analyze="False" AnalyzeAllChildren="False" />
+ <Target Name="$(ProjectDir)/../../packages/PortableLibrary/System.ServiceModel.dll" Analyze="False" AnalyzeAllChildren="False" />
+ <Target Name="$(ProjectDir)/../../packages/PortableLibrary/System.Xml.dll" Analyze="False" AnalyzeAllChildren="False" />
+ <Target Name="$(ProjectDir)/../../packages/PortableLibrary/System.Xml.Serialization.dll" Analyze="False" AnalyzeAllChildren="False" />
+ </Targets>
<Rules>
<RuleFiles>
- <RuleFile Name="$(FxCopDir)\Rules\DesignRules.dll" Enabled="True" AllRulesEnabled="True" />
+ <RuleFile Name="$(FxCopDir)\Rules\DesignRules.dll" Enabled="True" AllRulesEnabled="False">
+ <Rule Name="AbstractTypesShouldNotHaveConstructors" Enabled="True" />
+ <Rule Name="AssembliesShouldHaveValidStrongNames" Enabled="True" />
+ <Rule Name="AvoidEmptyInterfaces" Enabled="True" />
+ <Rule Name="AvoidExcessiveParametersOnGenericTypes" Enabled="True" />
+ <Rule Name="AvoidNamespacesWithFewTypes" Enabled="True" />
+ <Rule Name="AvoidOutParameters" Enabled="True" />
+ <Rule Name="CollectionsShouldImplementGenericInterface" Enabled="True" />
+ <Rule Name="ConsiderPassingBaseTypesAsParameters" Enabled="True" />
+ <Rule Name="DeclareEventHandlersCorrectly" Enabled="True" />
+ <Rule Name="DeclareTypesInNamespaces" Enabled="True" />
+ <Rule Name="DefineAccessorsForAttributeArguments" Enabled="True" />
+ <Rule Name="DoNotCatchGeneralExceptionTypes" Enabled="True" />
+ <Rule Name="DoNotDeclareProtectedMembersInSealedTypes" Enabled="True" />
+ <Rule Name="DoNotDeclareStaticMembersOnGenericTypes" Enabled="True" />
+ <Rule Name="DoNotDeclareVirtualMembersInSealedTypes" Enabled="True" />
+ <Rule Name="DoNotDeclareVisibleInstanceFields" Enabled="True" />
+ <Rule Name="DoNotExposeGenericLists" Enabled="True" />
+ <Rule Name="DoNotHideBaseClassMethods" Enabled="True" />
+ <Rule Name="DoNotNestGenericTypesInMemberSignatures" Enabled="True" />
+ <Rule Name="DoNotOverloadOperatorEqualsOnReferenceTypes" Enabled="True" />
+ <Rule Name="DoNotPassTypesByReference" Enabled="True" />
+ <Rule Name="DoNotRaiseExceptionsInUnexpectedLocations" Enabled="True" />
+ <Rule Name="EnumeratorsShouldBeStronglyTyped" Enabled="True" />
+ <Rule Name="EnumsShouldHaveZeroValue" Enabled="True" />
+ <Rule Name="EnumStorageShouldBeInt32" Enabled="True" />
+ <Rule Name="ExceptionsShouldBePublic" Enabled="True" />
+ <Rule Name="GenericMethodsShouldProvideTypeParameter" Enabled="True" />
+ <Rule Name="ICollectionImplementationsHaveStronglyTypedMembers" Enabled="True" />
+ <Rule Name="ImplementIDisposableCorrectly" Enabled="True" />
+ <Rule Name="ImplementStandardExceptionConstructors" Enabled="True" />
+ <Rule Name="IndexersShouldNotBeMultidimensional" Enabled="True" />
+ <Rule Name="InterfaceMethodsShouldBeCallableByChildTypes" Enabled="True" />
+ <Rule Name="ListsAreStronglyTyped" Enabled="True" />
+ <Rule Name="MarkAssembliesWithAssemblyVersion" Enabled="True" />
+ <Rule Name="MarkAssembliesWithClsCompliant" Enabled="True" />
+ <Rule Name="MarkAssembliesWithComVisible" Enabled="True" />
+ <Rule Name="MarkAttributesWithAttributeUsage" Enabled="True" />
+ <Rule Name="MarkEnumsWithFlags" Enabled="True" />
+ <Rule Name="MembersShouldNotExposeCertainConcreteTypes" Enabled="True" />
+ <Rule Name="MovePInvokesToNativeMethodsClass" Enabled="True" />
+ <Rule Name="NestedTypesShouldNotBeVisible" Enabled="True" />
+ <Rule Name="OverloadOperatorEqualsOnOverloadingAddAndSubtract" Enabled="True" />
+ <Rule Name="OverrideMethodsOnComparableTypes" Enabled="True" />
+ <Rule Name="PropertiesShouldNotBeWriteOnly" Enabled="True" />
+ <Rule Name="ProvideObsoleteAttributeMessage" Enabled="True" />
+ <Rule Name="ReplaceRepetitiveArgumentsWithParamsArray" Enabled="True" />
+ <Rule Name="StaticHolderTypesShouldBeSealed" Enabled="True" />
+ <Rule Name="StaticHolderTypesShouldNotHaveConstructors" Enabled="True" />
+ <Rule Name="StringUriOverloadsCallSystemUriOverloads" Enabled="True" />
+ <Rule Name="TypesShouldNotExtendCertainBaseTypes" Enabled="True" />
+ <Rule Name="TypesThatOwnDisposableFieldsShouldBeDisposable" Enabled="True" />
+ <Rule Name="TypesThatOwnNativeResourcesShouldBeDisposable" Enabled="True" />
+ <Rule Name="UriParametersShouldNotBeStrings" Enabled="True" />
+ <Rule Name="UriPropertiesShouldNotBeStrings" Enabled="True" />
+ <Rule Name="UriReturnValuesShouldNotBeStrings" Enabled="True" />
+ <Rule Name="UseEventsWhereAppropriate" Enabled="True" />
+ <Rule Name="UseGenericEventHandlerInstances" Enabled="True" />
+ <Rule Name="UseGenericsWhereAppropriate" Enabled="True" />
+ <Rule Name="UseIntegralOrStringArgumentForIndexers" Enabled="True" />
+ <Rule Name="UsePropertiesWhereAppropriate" Enabled="True" />
+ </RuleFile>
<RuleFile Name="$(FxCopDir)\Rules\GlobalizationRules.dll" Enabled="True" AllRulesEnabled="True" />
<RuleFile Name="$(FxCopDir)\Rules\InteroperabilityRules.dll" Enabled="True" AllRulesEnabled="False">
<Rule Name="AutoLayoutTypesShouldNotBeComVisible" Enabled="True" />
Added: incubator/lucene.net/branches/Lucene.Net_4e/packages/Lucene.Net.snk
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_4e/packages/Lucene.Net.snk?rev=1157250&view=auto
==============================================================================
Files incubator/lucene.net/branches/Lucene.Net_4e/packages/Lucene.Net.snk (added) and incubator/lucene.net/branches/Lucene.Net_4e/packages/Lucene.Net.snk Fri Aug 12 21:00:55 2011 differ
Added: incubator/lucene.net/branches/Lucene.Net_4e/packages/PortableLibrary/System.ComponentModel.Composition.dll
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_4e/packages/PortableLibrary/System.ComponentModel.Composition.dll?rev=1157250&view=auto
==============================================================================
Files incubator/lucene.net/branches/Lucene.Net_4e/packages/PortableLibrary/System.ComponentModel.Composition.dll (added) and incubator/lucene.net/branches/Lucene.Net_4e/packages/PortableLibrary/System.ComponentModel.Composition.dll Fri Aug 12 21:00:55 2011 differ
Added: incubator/lucene.net/branches/Lucene.Net_4e/packages/PortableLibrary/System.Core.dll
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_4e/packages/PortableLibrary/System.Core.dll?rev=1157250&view=auto
==============================================================================
Files incubator/lucene.net/branches/Lucene.Net_4e/packages/PortableLibrary/System.Core.dll (added) and incubator/lucene.net/branches/Lucene.Net_4e/packages/PortableLibrary/System.Core.dll Fri Aug 12 21:00:55 2011 differ
Added: incubator/lucene.net/branches/Lucene.Net_4e/packages/PortableLibrary/System.Net.dll
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_4e/packages/PortableLibrary/System.Net.dll?rev=1157250&view=auto
==============================================================================
Files incubator/lucene.net/branches/Lucene.Net_4e/packages/PortableLibrary/System.Net.dll (added) and incubator/lucene.net/branches/Lucene.Net_4e/packages/PortableLibrary/System.Net.dll Fri Aug 12 21:00:55 2011 differ
Added: incubator/lucene.net/branches/Lucene.Net_4e/packages/PortableLibrary/System.Runtime.Serialization.dll
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_4e/packages/PortableLibrary/System.Runtime.Serialization.dll?rev=1157250&view=auto
==============================================================================
Files incubator/lucene.net/branches/Lucene.Net_4e/packages/PortableLibrary/System.Runtime.Serialization.dll (added) and incubator/lucene.net/branches/Lucene.Net_4e/packages/PortableLibrary/System.Runtime.Serialization.dll Fri Aug 12 21:00:55 2011 differ
Added: incubator/lucene.net/branches/Lucene.Net_4e/packages/PortableLibrary/System.ServiceModel.dll
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_4e/packages/PortableLibrary/System.ServiceModel.dll?rev=1157250&view=auto
==============================================================================
Files incubator/lucene.net/branches/Lucene.Net_4e/packages/PortableLibrary/System.ServiceModel.dll (added) and incubator/lucene.net/branches/Lucene.Net_4e/packages/PortableLibrary/System.ServiceModel.dll Fri Aug 12 21:00:55 2011 differ
Added: incubator/lucene.net/branches/Lucene.Net_4e/packages/PortableLibrary/System.Xml.Serialization.dll
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_4e/packages/PortableLibrary/System.Xml.Serialization.dll?rev=1157250&view=auto
==============================================================================
Files incubator/lucene.net/branches/Lucene.Net_4e/packages/PortableLibrary/System.Xml.Serialization.dll (added) and incubator/lucene.net/branches/Lucene.Net_4e/packages/PortableLibrary/System.Xml.Serialization.dll Fri Aug 12 21:00:55 2011 differ
Added: incubator/lucene.net/branches/Lucene.Net_4e/packages/PortableLibrary/System.Xml.dll
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_4e/packages/PortableLibrary/System.Xml.dll?rev=1157250&view=auto
==============================================================================
Files incubator/lucene.net/branches/Lucene.Net_4e/packages/PortableLibrary/System.Xml.dll (added) and incubator/lucene.net/branches/Lucene.Net_4e/packages/PortableLibrary/System.Xml.dll Fri Aug 12 21:00:55 2011 differ
Added: incubator/lucene.net/branches/Lucene.Net_4e/packages/PortableLibrary/System.dll
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_4e/packages/PortableLibrary/System.dll?rev=1157250&view=auto
==============================================================================
Files incubator/lucene.net/branches/Lucene.Net_4e/packages/PortableLibrary/System.dll (added) and incubator/lucene.net/branches/Lucene.Net_4e/packages/PortableLibrary/System.dll Fri Aug 12 21:00:55 2011 differ
Added: incubator/lucene.net/branches/Lucene.Net_4e/packages/PortableLibrary/mscorlib.dll
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_4e/packages/PortableLibrary/mscorlib.dll?rev=1157250&view=auto
==============================================================================
Files incubator/lucene.net/branches/Lucene.Net_4e/packages/PortableLibrary/mscorlib.dll (added) and incubator/lucene.net/branches/Lucene.Net_4e/packages/PortableLibrary/mscorlib.dll Fri Aug 12 21:00:55 2011 differ
Modified: incubator/lucene.net/branches/Lucene.Net_4e/src/Lucene.Net.TestFramework/Lucene.Net.TestFramework.csproj
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_4e/src/Lucene.Net.TestFramework/Lucene.Net.TestFramework.csproj?rev=1157250&r1=1157249&r2=1157250&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_4e/src/Lucene.Net.TestFramework/Lucene.Net.TestFramework.csproj (original)
+++ incubator/lucene.net/branches/Lucene.Net_4e/src/Lucene.Net.TestFramework/Lucene.Net.TestFramework.csproj Fri Aug 12 21:00:55 2011
@@ -3,24 +3,25 @@
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <ProductVersion>8.0.30703</ProductVersion>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{756B5043-39EC-4C04-AC1F-AA959267DDC1}</ProjectGuid>
+ <ProjectGuid>{F8518746-08D2-44A0-AF67-D6F0FA74C5CA}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Lucene.Net</RootNamespace>
<AssemblyName>Lucene.Net.TestFramework</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+ <TargetFrameworkProfile>Profile2</TargetFrameworkProfile>
<FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
- <OutputPath>bin\Debug\</OutputPath>
+ <OutputPath>..\..\build\bin\core\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
+ <DocumentationFile>..\..\build\bin\core\Debug\Lucene.Net.TestFramework.XML</DocumentationFile>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
@@ -30,31 +31,29 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
+ <PropertyGroup>
+ <SignAssembly>true</SignAssembly>
+ </PropertyGroup>
+ <PropertyGroup>
+ <AssemblyOriginatorKeyFile>Lucene.Net.snk</AssemblyOriginatorKeyFile>
+ </PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
- <Reference Include="System.Xml.Linq" />
- <Reference Include="System.Data.DataSetExtensions" />
- <Reference Include="Microsoft.CSharp" />
- <Reference Include="System.Data" />
+ <Reference Include="System.Net" />
+ <Reference Include="System.Runtime.Serialization" />
+ <Reference Include="System.ServiceModel" />
<Reference Include="System.Xml" />
+ <Reference Include="System.Xml.Serialization" />
</ItemGroup>
<ItemGroup>
- <Compile Include="Extensions\NUnit\ParallelizeableAttribute.cs" />
- <Compile Include="Extensions\NUnit\TestScope.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="TestCategories.cs" />
</ItemGroup>
<ItemGroup>
- <ProjectReference Include="..\Lucene.Net\Lucene.Net.csproj">
- <Project>{07A5FF70-1EFE-4B0B-B338-5CA56C3A2826}</Project>
- <Name>Lucene.Net</Name>
- </ProjectReference>
- </ItemGroup>
- <ItemGroup>
- <Folder Include="TestFramework\" />
+ <None Include="Lucene.Net.snk" />
</ItemGroup>
- <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+ <Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
Added: incubator/lucene.net/branches/Lucene.Net_4e/src/Lucene.Net.TestFramework/Lucene.Net.snk
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_4e/src/Lucene.Net.TestFramework/Lucene.Net.snk?rev=1157250&view=auto
==============================================================================
Files incubator/lucene.net/branches/Lucene.Net_4e/src/Lucene.Net.TestFramework/Lucene.Net.snk (added) and incubator/lucene.net/branches/Lucene.Net_4e/src/Lucene.Net.TestFramework/Lucene.Net.snk Fri Aug 12 21:00:55 2011 differ
Modified: incubator/lucene.net/branches/Lucene.Net_4e/src/Lucene.Net.TestFramework/Properties/AssemblyInfo.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_4e/src/Lucene.Net.TestFramework/Properties/AssemblyInfo.cs?rev=1157250&r1=1157249&r2=1157250&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_4e/src/Lucene.Net.TestFramework/Properties/AssemblyInfo.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net_4e/src/Lucene.Net.TestFramework/Properties/AssemblyInfo.cs Fri Aug 12 21:00:55 2011
@@ -1,7 +1,6 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
-using System;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
@@ -15,16 +14,6 @@ using System;
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
-[assembly: CLSCompliant(true)]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("b5c988c9-3853-4e2a-b86e-41296167ed84")]
-
// Version information for an assembly consists of the following four values:
//
// Major Version
Modified: incubator/lucene.net/branches/Lucene.Net_4e/src/Lucene.Net.TestFramework/TestCategories.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_4e/src/Lucene.Net.TestFramework/TestCategories.cs?rev=1157250&r1=1157249&r2=1157250&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_4e/src/Lucene.Net.TestFramework/TestCategories.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net_4e/src/Lucene.Net.TestFramework/TestCategories.cs Fri Aug 12 21:00:55 2011
@@ -1,5 +1,5 @@
// -----------------------------------------------------------------------
-// <copyright company="Apache" file="TestCategories.cs">
+// <copyright company="Apache" file="TestingCategories.cs">
//
// Licensed to the Apache Software Foundation (ASF) under one or more
// contributor license agreements. See the NOTICE file distributed with
@@ -27,41 +27,10 @@ namespace Lucene.Net
using System.Text;
/// <summary>
- /// The categories for test fixtures.
+ ///
/// </summary>
public class TestCategories
{
- /// <summary>
- /// Tests that only validate the functionality of a unit of code. These
- /// should generally run fast and never depend on other tests functionality
- /// or running in any particular order.
- /// </summary>
public const string Unit = "Unit";
-
- /// <summary>
- /// Tests that validate integration against remote or internal dependencies.
- /// These tests will generally require external resources like files or data
- /// bases.
- /// </summary>
- public const string Integration = "Integration";
-
- /// <summary>
- /// Tests that validate specific overall stories or functionality that the
- /// libraries or applications must perform. Think acceptance testing or
- /// blackbox testing.
- /// </summary>
- public const string Functional = "Functional";
-
- /// <summary>
- /// Tests that validate performance requirements.
- /// </summary>
- public const string Performance = "Performance";
-
- /// <summary>
- /// Tests that are going to take a long period of time to execute. This
- /// is a meta category for excluding long running tests while trying
- /// to develop and run unit tests often.
- /// </summary>
- public const string LongRunning = "LongRunning";
}
-}
+}
\ No newline at end of file
Modified: incubator/lucene.net/branches/Lucene.Net_4e/src/Lucene.Net/Analysis/Analyzer.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_4e/src/Lucene.Net/Analysis/Analyzer.cs?rev=1157250&r1=1157249&r2=1157250&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_4e/src/Lucene.Net/Analysis/Analyzer.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net_4e/src/Lucene.Net/Analysis/Analyzer.cs Fri Aug 12 21:00:55 2011
@@ -42,10 +42,19 @@ namespace Lucene.Net.Analysis
{
if (this.AssertSealed() == false)
throw new TypeLoadException(
- string.Format(
- "{0} can not be used. It must be sealed or at least seal" +
- " the TokenStream and ResuableTokenStream methods",
- this.GetType().Name));
+ "{0} can not be used. It must be sealed or at least seal" +
+ " the TokenStream and ResuableTokenStream methods"
+ .Inject(this.GetType().Name));
+ }
+
+
+ /// <summary>
+ /// Gets the offset gap.
+ /// </summary>
+ /// <value>An instance of <see cref="Int32"/>.</value>
+ public virtual int OffsetGap
+ {
+ get { return 0; }
}
@@ -61,10 +70,7 @@ namespace Lucene.Net.Analysis
get
{
if (this.disposed)
- throw new ObjectDisposedException(
- string.Format(
- "This analyzer '{0}' has already been disposed",
- this.GetType().FullName));
+ throw new ObjectDisposedException(this.GetType().FullName);
if (!this.threadLocalTokenStream.IsValueCreated)
return null;
@@ -74,10 +80,7 @@ namespace Lucene.Net.Analysis
set
{
if (this.disposed)
- throw new ObjectDisposedException(
- string.Format(
- "This analyzer '{0}' has already been disposed",
- this.GetType().FullName));
+ throw new ObjectDisposedException(this.GetType().FullName);
this.threadLocalTokenStream.Value = value;
}
@@ -89,20 +92,11 @@ namespace Lucene.Net.Analysis
public void Dispose()
{
this.Dispose(true);
- this.disposed = true;
- this.threadLocalTokenStream.Dispose();
- this.threadLocalTokenStream = null;
+ GC.SuppressFinalize(this);
}
- /// <summary>
- /// Gets the offset gap.
- /// </summary>
- /// <returns>An instance of <see cref="Int32"/>.</returns>
- public virtual int GetOffsetGap()
- {
- return 0;
- }
+
/// <summary>
/// Gets the position increment gap.
@@ -144,14 +138,24 @@ namespace Lucene.Net.Analysis
/// <param name="disposing"><c>true</c> to release both managed and unmanaged resources; <c>false</c> to release only unmanaged resources.</param>
protected virtual void Dispose(bool disposing)
{
+ if (disposing)
+ {
+ this.disposed = true;
+ this.threadLocalTokenStream.Dispose();
+ this.threadLocalTokenStream = null;
+ }
}
- // this was ported from lucene, but I'm not convinced this is best way
- // to handle this kind of design decision.
+ // AssertSealed was ported from java-lucene-core, but I'm not convinced
+ // this is best way to handle this kind of design decision in .NET.
+
+ // It might be better to create an analysis tool or put these kind of
+ // assertions inside the testing framework.
+ // TODO: remove AssertSealed() / assertSealed.
private bool AssertSealed()
{
Type type = this.GetType();
-
+
if (type.IsSealed || type.IsAbstract)
return true;
Modified: incubator/lucene.net/branches/Lucene.Net_4e/src/Lucene.Net/Analysis/TokenAttributes/CharTermAttribute.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_4e/src/Lucene.Net/Analysis/TokenAttributes/CharTermAttribute.cs?rev=1157250&r1=1157249&r2=1157250&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_4e/src/Lucene.Net/Analysis/TokenAttributes/CharTermAttribute.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net_4e/src/Lucene.Net/Analysis/TokenAttributes/CharTermAttribute.cs Fri Aug 12 21:00:55 2011
@@ -22,7 +22,10 @@
namespace Lucene.Net.Analysis.TokenAttributes
{
using System;
+ using System.Collections.Generic;
+ using System.Linq;
using System.Text;
+ using Support;
using Util;
/// <summary>
@@ -57,6 +60,7 @@ namespace Lucene.Net.Analysis.TokenAttri
{
private const int MinBufferSize = 10;
private int termLength;
+ private char[] buffer;
/// <summary>
@@ -64,23 +68,38 @@ namespace Lucene.Net.Analysis.TokenAttri
/// </summary>
public CharTermAttribute()
{
- this.Buffer = CreateBuffer(MinBufferSize);
+ this.buffer = CreateBuffer(MinBufferSize);
}
/// <summary>
- /// Gets the internal termBuffer character array which you can then
+ /// Gets or sets the internal termBuffer character array which you can then
/// directly alter.
/// </summary>
/// <value>The buffer.</value>
/// <remarks>
/// <para>
+ /// You may cast this to a <c>char[]</c> rather than calling the <c>ToArray()</c>
+ /// on <see cref="Buffer"/>.
+ /// </para>
+ /// <para>
/// If the array is too small for the token, use <see cref="SetLength(int)"/>
/// to increase the size. After altering the buffer be sure to call
/// <see cref="SetLength(int)"/> to record the valid characters that
/// were placed into the termBuffer.
/// </para>
/// </remarks>
- public char[] Buffer { get; private set; }
+ public IEnumerable<char> Buffer
+ {
+ get
+ {
+ return this.buffer;
+ }
+
+ protected set
+ {
+ this.buffer = value.ToArray();
+ }
+ }
/// <summary>
/// Gets or sets the number of valid characters, the length of the term, in
@@ -115,7 +134,7 @@ namespace Lucene.Net.Analysis.TokenAttri
int newLength = this.termLength + 1;
this.ResizeBuffer(newLength);
- this.Buffer[newLength] = value;
+ this.buffer[newLength] = value;
return this;
}
@@ -148,7 +167,7 @@ namespace Lucene.Net.Analysis.TokenAttri
if (value == null)
return this.AppendNull();
- value.CopyTo(startingIndex, this.ResizeBuffer(this.termLength + length), this.termLength, length);
+ value.CopyTo(startingIndex, this.InternalResizeBuffer(this.termLength + length), this.termLength, length);
this.Length += length;
return this;
@@ -185,7 +204,11 @@ namespace Lucene.Net.Analysis.TokenAttri
int length = value.Length;
- Array.Copy(value.Buffer, 0, this.ResizeBuffer(this.termLength + length), this.termLength, length);
+ CharTermAttribute innerValue = value as CharTermAttribute;
+
+ char[] array = innerValue == null ? value.Buffer.ToArray() : innerValue.buffer;
+
+ Array.Copy(array, 0, this.InternalResizeBuffer(this.termLength + length), this.termLength, length);
this.termLength += length;
return this;
@@ -197,15 +220,15 @@ namespace Lucene.Net.Analysis.TokenAttri
/// </summary>
/// <param name="index">The position of the character.</param>
/// <returns>An instance of <see cref="Char"/>.</returns>
- /// <exception cref="IndexOutOfRangeException">
+ /// <exception cref="ArgumentOutOfRangeException">
/// Throws when the index is equal or greater than the current buffer length
/// </exception>
public char CharAt(int index)
{
if (index >= this.termLength)
- throw new IndexOutOfRangeException();
+ throw new ArgumentOutOfRangeException("index");
- return this.Buffer[index];
+ return this.buffer[index];
}
/// <summary>
@@ -225,7 +248,7 @@ namespace Lucene.Net.Analysis.TokenAttri
CharTermAttribute clone = (CharTermAttribute)this.MemberwiseClone();
clone.Buffer = new char[this.termLength];
- Array.Copy(this.Buffer, 0, clone.Buffer, 0, this.termLength);
+ Array.Copy(this.buffer, 0, clone.buffer, 0, this.termLength);
return clone;
}
@@ -242,7 +265,7 @@ namespace Lucene.Net.Analysis.TokenAttri
length = buffer.Length;
this.GrowBuffer(length);
- Array.Copy(buffer, offset, this.Buffer, 0, length);
+ Array.Copy(buffer, offset, this.buffer, 0, length);
this.termLength = length;
}
@@ -253,7 +276,7 @@ namespace Lucene.Net.Analysis.TokenAttri
public override void CopyTo(AttributeBase attributeBase)
{
ICharTermAttribute attribute = (ICharTermAttribute)attributeBase;
- attribute.CopyBuffer(this.Buffer, 0, this.termLength);
+ attribute.CopyBuffer(this.buffer, 0, this.termLength);
}
/// <summary>
@@ -283,23 +306,21 @@ namespace Lucene.Net.Analysis.TokenAttri
if (this == obj)
return true;
- if (obj is CharTermAttribute)
- {
- CharTermAttribute y = (CharTermAttribute)obj;
-
- if (this.termLength != y.termLength)
- return false;
+ CharTermAttribute attribute = obj as CharTermAttribute;
+
+ if (attribute == null)
+ return false;
- for (int i = 0; i < this.termLength; i++)
- {
- if (this.Buffer[i] != y.Buffer[i])
- return false;
- }
+ if (this.termLength != attribute.termLength)
+ return false;
- return true;
+ for (int i = 0; i < this.termLength; i++)
+ {
+ if (this.buffer[i] != attribute.buffer[i])
+ return false;
}
- return false;
+ return true;
}
/// <summary>
@@ -312,7 +333,7 @@ namespace Lucene.Net.Analysis.TokenAttri
public override int GetHashCode()
{
int code = this.termLength;
- code = (code * 31) + this.Buffer.CreateHashCode();
+ code = (code * 31) + this.buffer.CreateHashCode();
return code;
}
@@ -323,18 +344,12 @@ namespace Lucene.Net.Analysis.TokenAttri
/// </summary>
/// <param name="length">The length to re-buffer to.</param>
/// <returns>The <see cref="T:System.Char"/> array.</returns>
- public char[] ResizeBuffer(int length)
+ public IEnumerable<char> ResizeBuffer(int length)
{
- if (this.Buffer.Length < length)
- {
- char[] newBuffer = CreateBuffer(length);
- Array.Copy(this.Buffer, 0, newBuffer, 0, this.Buffer.Length);
- this.Buffer = newBuffer;
- }
-
- return this.Buffer;
+ return this.InternalResizeBuffer(length);
}
+
/// <summary>
/// Gets or sets the number of valid characters, the length of the term, in
/// the termBuffer array.
@@ -355,12 +370,11 @@ namespace Lucene.Net.Analysis.TokenAttri
/// </returns>
public ICharTermAttribute SetLength(int length)
{
- if (length > this.Buffer.Length)
+ if (length > this.buffer.Length)
{
- string message = string.Format(
- "The given length '{0}' needs to be less than current the internal buffer length '{1}'",
- length,
- this.Buffer.Length);
+ string message =
+ "The given length '{0}' needs to be less than current the internal buffer length '{1}'"
+ .Inject(length, this.buffer.Length);
throw new ArgumentOutOfRangeException("length", message);
}
@@ -379,7 +393,7 @@ namespace Lucene.Net.Analysis.TokenAttri
/// </returns>
public override string ToString()
{
- return new string(this.Buffer).Substring(0, this.termLength);
+ return new string(this.buffer).Substring(0, this.termLength);
}
private static char[] CreateBuffer(int length)
@@ -391,18 +405,30 @@ namespace Lucene.Net.Analysis.TokenAttri
{
this.ResizeBuffer(this.termLength + 4);
- this.Buffer[this.termLength++] = 'n';
- this.Buffer[this.termLength++] = 'u';
- this.Buffer[this.termLength++] = 'l';
- this.Buffer[this.termLength++] = 'l';
+ this.buffer[this.termLength++] = 'n';
+ this.buffer[this.termLength++] = 'u';
+ this.buffer[this.termLength++] = 'l';
+ this.buffer[this.termLength++] = 'l';
return this;
}
private void GrowBuffer(int length)
{
- if (this.Buffer.Length < length)
+ if (this.buffer.Length < length)
this.Buffer = CreateBuffer(length);
}
+
+ private char[] InternalResizeBuffer(int length)
+ {
+ if (this.buffer.Length < length)
+ {
+ char[] newBuffer = CreateBuffer(length);
+ Array.Copy(this.buffer, 0, newBuffer, 0, this.buffer.Length);
+ this.buffer = newBuffer;
+ }
+
+ return this.buffer;
+ }
}
}
\ No newline at end of file
Modified: incubator/lucene.net/branches/Lucene.Net_4e/src/Lucene.Net/Analysis/TokenAttributes/FlagsAttribute.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_4e/src/Lucene.Net/Analysis/TokenAttributes/FlagsAttribute.cs?rev=1157250&r1=1157249&r2=1157250&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_4e/src/Lucene.Net/Analysis/TokenAttributes/FlagsAttribute.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net_4e/src/Lucene.Net/Analysis/TokenAttributes/FlagsAttribute.cs Fri Aug 12 21:00:55 2011
@@ -22,6 +22,7 @@
namespace Lucene.Net.Analysis.TokenAttributes
{
using System;
+ using Support;
using Util;
// DOCS: enhance FlagsAttribute summary
@@ -100,12 +101,13 @@ namespace Lucene.Net.Analysis.TokenAttri
/// </exception>
public override void CopyTo(AttributeBase attributeBase)
{
- if (!(attributeBase is IFlagsAttribute))
+ IFlagsAttribute attribute = attributeBase as IFlagsAttribute;
+ if (attribute == null)
throw new ArgumentException(
- string.Format("attributeBase must be of type {0} in order to be copied", this.GetType().FullName),
+ "The parameter 'attributeBase' must be of type {0} in order to be copied"
+ .Inject(this.GetType().FullName),
"attributeBase");
- IFlagsAttribute attribute = (IFlagsAttribute)attributeBase;
attribute.Flags = this.Flags;
}
@@ -131,9 +133,10 @@ namespace Lucene.Net.Analysis.TokenAttri
{
if (this == obj)
return true;
-
- if (obj is FlagsAttribute)
- return ((FlagsAttribute)obj).Flags == this.Flags;
+
+ FlagsAttribute attribute = obj as FlagsAttribute;
+ if (attribute != null)
+ return attribute.Flags == this.Flags;
return false;
}
Modified: incubator/lucene.net/branches/Lucene.Net_4e/src/Lucene.Net/Analysis/TokenAttributes/ICharTermAttribute.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_4e/src/Lucene.Net/Analysis/TokenAttributes/ICharTermAttribute.cs?rev=1157250&r1=1157249&r2=1157250&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_4e/src/Lucene.Net/Analysis/TokenAttributes/ICharTermAttribute.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net_4e/src/Lucene.Net/Analysis/TokenAttributes/ICharTermAttribute.cs Fri Aug 12 21:00:55 2011
@@ -22,9 +22,12 @@
namespace Lucene.Net.Analysis.TokenAttributes
{
+ using System;
+ using System.Collections.Generic;
using System.Text;
using Util;
+
/// <summary>
/// The term text of a Token.
/// </summary>
@@ -57,7 +60,7 @@ namespace Lucene.Net.Analysis.TokenAttri
/// </para>
/// </remarks>
/// <value>The buffer.</value>
- char[] Buffer { get; }
+ IEnumerable<char> Buffer { get; }
/// <summary>
/// Gets or sets the number of valid characters, the length of the term, in
@@ -151,8 +154,8 @@ namespace Lucene.Net.Analysis.TokenAttri
/// Resizes the buffer.
/// </summary>
/// <param name="length">The length.</param>
- /// <returns>An instance of <see cref="T:System.Char[]"/>.</returns>
- char[] ResizeBuffer(int length);
+ /// <returns>An instance of <see cref="IEnumerable{T}"/>.</returns>
+ IEnumerable<char> ResizeBuffer(int length);
/// <summary>
Modified: incubator/lucene.net/branches/Lucene.Net_4e/src/Lucene.Net/Index/Payload.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_4e/src/Lucene.Net/Index/Payload.cs?rev=1157250&r1=1157249&r2=1157250&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_4e/src/Lucene.Net/Index/Payload.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net_4e/src/Lucene.Net/Index/Payload.cs Fri Aug 12 21:00:55 2011
@@ -25,6 +25,7 @@ namespace Lucene.Net.Index
{
using System;
using System.Collections.Generic;
+ using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Text;
using Lucene.Net.Support;
@@ -43,6 +44,7 @@ namespace Lucene.Net.Index
/// </summary>
public Payload()
{
+ this.Data = new byte[] { };
}
/// <summary>
@@ -72,6 +74,9 @@ namespace Lucene.Net.Index
/// Gets or sets the data.
/// </summary>
/// <value>The data.</value>
+ [SuppressMessage("Microsoft.Performance",
+ "CA1819:PropertiesShouldNotReturnArrays",
+ Justification = "Lucene code base uses byte[] through out.")]
public byte[] Data
{
get
@@ -98,12 +103,11 @@ namespace Lucene.Net.Index
{
if (0 <= index && index < this.Length)
return this.Data[this.Offset + index];
-
- throw new IndexOutOfRangeException(
- string.Format(
- "The index must be greater than 0 and less than the length '{0}', The index was '{1}'",
- this.Length,
- index));
+
+ throw new ArgumentOutOfRangeException(
+ "index",
+ "The index must be greater than 0 and less than the length '{0}'. " +
+ "The index was '{1}'. ".Inject(this.Length, index));
}
/// <summary>
@@ -146,11 +150,13 @@ namespace Lucene.Net.Index
throw new ArgumentNullException("target");
if (this.Length > target.Length + offset)
- throw new IndexOutOfRangeException(
- string.Format(
- "The combined target length and offset '{0}' must be smaller the payload length '{1}' ",
- target.Length + offset,
- this.Length));
+ {
+ var message = "The combined target length and offset '{0}' must be smaller the payload length '{1}' "
+ .Inject((target.Length + offset), this.Length);
+
+ throw new ArgumentOutOfRangeException("target", message);
+ }
+
Array.Copy(this.Data, this.Offset, target, offset, this.Length);
}
@@ -167,10 +173,10 @@ namespace Lucene.Net.Index
if (obj == this)
return true;
- if (!(obj is Payload))
- return false;
+ Payload payload = obj as Payload;
- Payload payload = (Payload)obj;
+ if (payload == null)
+ return false;
if (this.Length == payload.Length)
{
@@ -213,11 +219,10 @@ namespace Lucene.Net.Index
{
if (offset < 0 || (offset + length) > data.Length)
throw new ArgumentException(
- string.Format(
- "The offset must be 0 or greater and the offset and length " +
- "combined must be less that length of byte[]. The offset was '{0}' ",
- offset),
- "offset");
+ "The offset must be 0 or greater and the offset and length " +
+ "combined must be less that length of byte[]." +
+ " The offset was '{0}'. ".Inject(offset),
+ "offset");
this.data = data;
this.Offset = offset;
Modified: incubator/lucene.net/branches/Lucene.Net_4e/src/Lucene.Net/Lucene.Net.csproj
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_4e/src/Lucene.Net/Lucene.Net.csproj?rev=1157250&r1=1157249&r2=1157250&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_4e/src/Lucene.Net/Lucene.Net.csproj (original)
+++ incubator/lucene.net/branches/Lucene.Net_4e/src/Lucene.Net/Lucene.Net.csproj Fri Aug 12 21:00:55 2011
@@ -18,7 +18,7 @@
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\..\build\bin\core\Debug\</OutputPath>
- <DefineConstants>TRACE;DEBUG;SILVERLIGHT;WMP;SILVERLIGHT_4;WMP_4</DefineConstants>
+ <DefineConstants>TRACE;DEBUG;CODE_ANALYSIS;SILVERLIGHT;WMP;SILVERLIGHT_4;WMP_4</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<DocumentationFile>..\..\build\bin\core\Debug\Lucene.Net.XML</DocumentationFile>
@@ -31,12 +31,18 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
+ <PropertyGroup>
+ <SignAssembly>true</SignAssembly>
+ </PropertyGroup>
+ <PropertyGroup>
+ <AssemblyOriginatorKeyFile>Lucene.Net.snk</AssemblyOriginatorKeyFile>
+ </PropertyGroup>
<ItemGroup>
<Reference Include="System">
- <Private>True</Private>
+ <Private>False</Private>
</Reference>
<Reference Include="System.Core">
- <Private>True</Private>
+ <Private>False</Private>
</Reference>
<Reference Include="System.Net" />
<Reference Include="System.Runtime.Serialization" />
@@ -72,6 +78,7 @@
<Compile Include="Support\DictionaryExtensions.cs" />
<Compile Include="Support\ICloneableOfT.cs" />
<Compile Include="Support\ICloseable.cs" />
+ <Compile Include="Support\StringExtensions.cs" />
<Compile Include="Support\Threading\LocalDataStoreSlot.cs" />
<Compile Include="Support\Threading\ThreadData.cs" />
<Compile Include="Support\Threading\ThreadLocalOfT.cs" />
@@ -84,10 +91,14 @@
<Compile Include="Util\AttributeBase.cs" />
<Compile Include="Util\AttributeFactory.cs" />
<Compile Include="Util\AttributeSource.cs" />
+ <Compile Include="Util\AttributeSourceState.cs" />
<Compile Include="Util\BytesRef.cs" />
<Compile Include="Util\IAttribute.cs" />
<Compile Include="Util\RamUsageEstimator.cs" />
</ItemGroup>
+ <ItemGroup>
+ <None Include="Lucene.Net.snk" />
+ </ItemGroup>
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />
<Import Condition="Exists('..\..\packages\StyleCop.4.5\StyleCop.targets')" Project="..\..\packages\StyleCop.4.5\StyleCop.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Added: incubator/lucene.net/branches/Lucene.Net_4e/src/Lucene.Net/Lucene.Net.snk
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_4e/src/Lucene.Net/Lucene.Net.snk?rev=1157250&view=auto
==============================================================================
Files incubator/lucene.net/branches/Lucene.Net_4e/src/Lucene.Net/Lucene.Net.snk (added) and incubator/lucene.net/branches/Lucene.Net_4e/src/Lucene.Net/Lucene.Net.snk Fri Aug 12 21:00:55 2011 differ
Modified: incubator/lucene.net/branches/Lucene.Net_4e/src/Lucene.Net/Properties/AssemblyInfo.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_4e/src/Lucene.Net/Properties/AssemblyInfo.cs?rev=1157250&r1=1157249&r2=1157250&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_4e/src/Lucene.Net/Properties/AssemblyInfo.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net_4e/src/Lucene.Net/Properties/AssemblyInfo.cs Fri Aug 12 21:00:55 2011
@@ -21,9 +21,8 @@
using System;
+using System.Diagnostics.CodeAnalysis;
using System.Reflection;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
@@ -51,3 +50,9 @@ using System.Runtime.InteropServices;
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
+
+//// Suppression
+[assembly: SuppressMessage("Microsoft.Design", "CA1020:AvoidNamespacesWithFewTypes", Scope = "namespace", Target = "Lucene.Net.Analysis", Justification = "This is an on going port, the namespace will only grow.")]
+[assembly: SuppressMessage("Microsoft.Design", "CA1020:AvoidNamespacesWithFewTypes", Scope = "namespace", Target = "Lucene.Net.Util", Justification = "This is an on going port, the namespace will only grow.")]
+[assembly: SuppressMessage("Microsoft.Design", "CA1020:AvoidNamespacesWithFewTypes", Scope = "namespace", Target = "Lucene.Net.Index", Justification = "This is an on going port, the namespace will only grow.")]
+[assembly: SuppressMessage("Microsoft.Design", "CA1020:AvoidNamespacesWithFewTypes", Scope = "namespace", Target = "Lucene.Net.Support.Threading", Justification = "This is an on going port, the namespace will only grow.")]
Modified: incubator/lucene.net/branches/Lucene.Net_4e/src/Lucene.Net/Settings.StyleCop
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_4e/src/Lucene.Net/Settings.StyleCop?rev=1157250&r1=1157249&r2=1157250&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_4e/src/Lucene.Net/Settings.StyleCop (original)
+++ incubator/lucene.net/branches/Lucene.Net_4e/src/Lucene.Net/Settings.StyleCop Fri Aug 12 21:00:55 2011
@@ -49,5 +49,15 @@
</Rules>
<AnalyzerSettings />
</Analyzer>
+ <Analyzer AnalyzerId="StyleCop.CSharp.ReadabilityRules">
+ <Rules>
+ <Rule Name="ParameterMustNotSpanMultipleLines">
+ <RuleSettings>
+ <BooleanProperty Name="Enabled">False</BooleanProperty>
+ </RuleSettings>
+ </Rule>
+ </Rules>
+ <AnalyzerSettings />
+ </Analyzer>
</Analyzers>
</StyleCopSettings>
\ No newline at end of file
Copied: incubator/lucene.net/branches/Lucene.Net_4e/src/Lucene.Net/Support/StringExtensions.cs (from r1156935, incubator/lucene.net/branches/Lucene.Net_4e/src/Lucene.Net/Util/BytesRef.cs)
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_4e/src/Lucene.Net/Support/StringExtensions.cs?p2=incubator/lucene.net/branches/Lucene.Net_4e/src/Lucene.Net/Support/StringExtensions.cs&p1=incubator/lucene.net/branches/Lucene.Net_4e/src/Lucene.Net/Util/BytesRef.cs&r1=1156935&r2=1157250&rev=1157250&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_4e/src/Lucene.Net/Util/BytesRef.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net_4e/src/Lucene.Net/Support/StringExtensions.cs Fri Aug 12 21:00:55 2011
@@ -1,5 +1,5 @@
// -----------------------------------------------------------------------
-// <copyright company="Apache" file="BytesRef.cs">
+// <copyright company="Apache" file="StringExtensions.cs">
//
// Licensed to the Apache Software Foundation (ASF) under one or more
// contributor license agreements. See the NOTICE file distributed with
@@ -19,26 +19,31 @@
// </copyright>
// -----------------------------------------------------------------------
-namespace Lucene.Net.Util
+
+
+namespace Lucene.Net.Support
{
using System;
using System.Collections.Generic;
+ using System.Globalization;
using System.Linq;
using System.Text;
/// <summary>
- /// TODO: port
+ /// Extension methods for strings
/// </summary>
- public sealed class BytesRef : IComparable<BytesRef>
+ internal static class StringExtensions
{
/// <summary>
- /// Compares this instance to the other <see cref="BytesRef"/> instance.
+ /// Alias for string.Format that uses <see cref="CultureInfo.InvariantCulture"/>
+ /// for formatting strings.
/// </summary>
- /// <param name="other">The other.</param>
- /// <returns>An instance of <see cref="Int32"/>.</returns>
- public int CompareTo(BytesRef other)
+ /// <param name="obj">The obj.</param>
+ /// <param name="args">The args.</param>
+ /// <returns>an instance of <see cref="string"/></returns>
+ public static string Inject(this string obj, params object[] args)
{
- throw new NotImplementedException();
+ return string.Format(System.Globalization.CultureInfo.InvariantCulture, obj, args);
}
}
}
\ No newline at end of file
Modified: incubator/lucene.net/branches/Lucene.Net_4e/src/Lucene.Net/Support/Threading/ThreadData.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_4e/src/Lucene.Net/Support/Threading/ThreadData.cs?rev=1157250&r1=1157249&r2=1157250&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_4e/src/Lucene.Net/Support/Threading/ThreadData.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net_4e/src/Lucene.Net/Support/Threading/ThreadData.cs Fri Aug 12 21:00:55 2011
@@ -151,8 +151,15 @@ namespace Lucene.Net.Support.Threading
/// </summary>
/// <param name="slot">The slot.</param>
/// <param name="isThread">if set to <c>true</c> [is thread].</param>
+ /// <exception cref="NotImplementedException">
+ /// Thrown when <paramref name="isThread"/> is true since the
+ /// storing data outside a thread context is currently not supported.
+ /// </exception>
public static void FreeLocalSlotData(int slot, bool isThread)
{
+ if (!isThread)
+ throw new NotImplementedException("FreeLocalSlotData currently only supports thread contexts");
+
lock (slotsSyncRoot)
{
object[] slots = null;
Modified: incubator/lucene.net/branches/Lucene.Net_4e/src/Lucene.Net/Support/Threading/ThreadLocalOfT.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_4e/src/Lucene.Net/Support/Threading/ThreadLocalOfT.cs?rev=1157250&r1=1157249&r2=1157250&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_4e/src/Lucene.Net/Support/Threading/ThreadLocalOfT.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net_4e/src/Lucene.Net/Support/Threading/ThreadLocalOfT.cs Fri Aug 12 21:00:55 2011
@@ -144,7 +144,7 @@ namespace Lucene.Net.Support.Threading
public void Dispose()
{
this.Dispose(true);
- this.disposed = true;
+ GC.SuppressFinalize(this);
}
/// <summary>
@@ -158,6 +158,7 @@ namespace Lucene.Net.Support.Threading
this.Factory = null;
ThreadData.FreeLocalSlotData(this.slot.SlotId, this.slot.IsThreadLocal);
this.slot = null;
+ this.disposed = true;
}
}
Modified: incubator/lucene.net/branches/Lucene.Net_4e/src/Lucene.Net/Util/AttributeBase.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_4e/src/Lucene.Net/Util/AttributeBase.cs?rev=1157250&r1=1157249&r2=1157250&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_4e/src/Lucene.Net/Util/AttributeBase.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net_4e/src/Lucene.Net/Util/AttributeBase.cs Fri Aug 12 21:00:55 2011
@@ -105,10 +105,9 @@ namespace Lucene.Net.Util
if (foundInterfaces.Count > 1)
throw new NotSupportedException(
- string.Format(
- "{0} implements more than one attribute interface. " +
- "The default ReflectWith(IAttributeReflector) implementation can not handle this.",
- type.FullName));
+ "{0} implements more than one attribute interface. " +
+ "The default ReflectWith(IAttributeReflector) implementation " +
+ "can not handle this.".Inject(type.FullName));
PropertyInfo[] properties = type.GetProperties(BindingFlags.Public | BindingFlags.Instance);
FieldInfo[] fields = type.GetFields(BindingFlags.Public | BindingFlags.Instance);
Modified: incubator/lucene.net/branches/Lucene.Net_4e/src/Lucene.Net/Util/AttributeFactory.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_4e/src/Lucene.Net/Util/AttributeFactory.cs?rev=1157250&r1=1157249&r2=1157250&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_4e/src/Lucene.Net/Util/AttributeFactory.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net_4e/src/Lucene.Net/Util/AttributeFactory.cs Fri Aug 12 21:00:55 2011
@@ -22,9 +22,9 @@
namespace Lucene.Net.Util
{
using System;
+ using System.Diagnostics.CodeAnalysis;
using Support;
-
/// <summary>
/// A contract for factories that create instances of <see cref="AttributeBase" />
/// that are map to interfaces that extend <see cref="IAttribute" />
@@ -58,6 +58,9 @@ namespace Lucene.Net.Util
/// removes the "I" from the interface name by using <c>type.Name.Substring(0)</c>.
/// </para>
/// </remarks>
+ [SuppressMessage("Microsoft.Security",
+ "CA2104:DoNotDeclareReadOnlyMutableReferenceTypes",
+ Justification = "Outside classes can not affect the DefaultAttributeFactory")]
public static readonly AttributeFactory DefaultFactory = new DefaultAttributeFactory();
/// <summary>
@@ -66,6 +69,9 @@ namespace Lucene.Net.Util
/// </summary>
/// <typeparam name="T">The type of interface</typeparam>
/// <returns>An instance of <see cref="AttributeBase"/>.</returns>
+ [SuppressMessage("Microsoft.Design",
+ "CA1004:GenericMethodsShouldProvideTypeParameter",
+ Justification = "This is similar to Activator.Create<T>.")]
public abstract AttributeBase CreateAttributeInstance<T>() where T : IAttribute;
/// <summary>
@@ -90,7 +96,6 @@ namespace Lucene.Net.Util
public override AttributeBase CreateAttributeInstance<T>()
{
- var implementationType = FetchClassForInterface(typeof(T));
return CreateAttributeInstance(typeof(T));
}
@@ -113,16 +118,14 @@ namespace Lucene.Net.Util
try
{
- value = Type.GetType(string.Format("{0}.{1}", type.Namespace, typeName));
+ value = Type.GetType("{0}.{1}".Inject(type.Namespace, typeName));
}
- catch (Exception ex)
+ catch (TypeLoadException ex)
{
throw new ArgumentException(
- string.Format(
- "The implementation '{0}' could not be found for attribute interface '{1}'",
- typeName,
- type.FullName),
- ex);
+ "The implementation type '{0}' could not be found for attribute " +
+ "interface '{1}'".Inject(typeName, type.FullName),
+ ex);
}
map.Add(type, value);
Modified: incubator/lucene.net/branches/Lucene.Net_4e/src/Lucene.Net/Util/AttributeSource.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_4e/src/Lucene.Net/Util/AttributeSource.cs?rev=1157250&r1=1157249&r2=1157250&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_4e/src/Lucene.Net/Util/AttributeSource.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net_4e/src/Lucene.Net/Util/AttributeSource.cs Fri Aug 12 21:00:55 2011
@@ -26,9 +26,11 @@ namespace Lucene.Net.Util
{
using System;
using System.Collections.Generic;
+ using System.Diagnostics.CodeAnalysis;
using Lucene.Net.Analysis;
using Lucene.Net.Analysis.TokenAttributes;
using Support;
+
/// <summary>
@@ -68,7 +70,7 @@ namespace Lucene.Net.Util
private readonly Dictionary<Type, AttributeBase> interfaceMap = new Dictionary<Type, AttributeBase>();
private readonly Dictionary<Type, AttributeBase> attributeMap = new Dictionary<Type, AttributeBase>();
- private State[] currentState;
+ private AttributeSourceState[] currentState;
/// <summary>
@@ -103,7 +105,7 @@ namespace Lucene.Net.Util
{
this.attributeMap = new Dictionary<Type, AttributeBase>();
this.interfaceMap = new Dictionary<Type, AttributeBase>();
- this.currentState = new State[1];
+ this.currentState = new AttributeSourceState[1];
this.Factory = factory;
}
@@ -136,6 +138,8 @@ namespace Lucene.Net.Util
/// an instance of <see cref="LinkedList{T}"/> of <see cref="WeakReference{T}"/> of <see cref="Type"/>
/// that hold the known interfaces that inherit from <see cref="IAttribute"/>.
/// </returns>
+ [SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypeMemberSignatures",
+ Justification = "I considered WeakReference<T> is needed.")]
public static LinkedList<WeakReference<Type>> GetAttributeInterfaces(Type type)
{
lock (instanceLock)
@@ -228,9 +232,8 @@ namespace Lucene.Net.Util
if (!attributeType.IsSubclassOf(typeof(IAttribute)))
throw new ArgumentException(
- string.Format(
- "The interface type '{0}' is not a subclass of IAttribute.",
- attributeType.FullName));
+ "The interface type '{0}' is not a subclass of IAttribute."
+ .Inject(attributeType.FullName));
this.AddAttribute(instance = this.Factory.CreateAttributeInstance(attributeType));
}
@@ -251,10 +254,10 @@ namespace Lucene.Net.Util
/// <summary>
/// Captures the state.
/// </summary>
- /// <returns>An instance of <see cref="State"/>.</returns>
- public State CaptureState()
+ /// <returns>An instance of <see cref="AttributeSourceState"/>.</returns>
+ public AttributeSourceState CaptureState()
{
- State state = this.GetCurrentState();
+ AttributeSourceState state = this.GetCurrentState();
return state == null ? null : state.Clone();
}
@@ -338,9 +341,9 @@ namespace Lucene.Net.Util
public void CopyTo(AttributeSource source)
{
this.ForEachState((state) => {
- var attribute = this.attributeMap[state.Attribute.GetType()];
+ var attribute = source.attributeMap[state.Attribute.GetType()];
if (attribute == null)
- throw new ArgumentException(this.CreateStateExceptionMessage(state));
+ throw new ArgumentException(this.CreateStateExceptionMessage(state), "state");
state.Attribute.CopyTo(attribute);
});
@@ -401,10 +404,9 @@ namespace Lucene.Net.Util
AttributeBase value;
if (!this.interfaceMap.TryGetValue(typeof(T), out value))
throw new ArgumentException(
- string.Format(
"The specified type '{0}' could not be found, try using " +
- "ContainsAttribute(Type) first.",
- typeof(T).FullName));
+ "ContainsAttribute(Type) first."
+ .Inject(typeof(T).FullName));
object unbox = value;
return (T)unbox;
@@ -415,10 +417,11 @@ namespace Lucene.Net.Util
/// be a <see cref="Type"/> that implements <see cref="AttributeBase"/>
/// and <see cref="IAttribute"/>.
/// </summary>
- /// <param name="type">The type.</param>
+ /// <param name="type">The <see cref="Type"/> of attribute to find.</param>
/// <returns>
/// An instance of <see cref="AttributeBase"/>.
/// </returns>
+ //// getAttribute(Class<A> attClass)
public AttributeBase FindAttribute(Type type)
{
AttributeBase value;
@@ -427,19 +430,15 @@ namespace Lucene.Net.Util
{
if (!this.interfaceMap.TryGetValue(type, out value))
throw new ArgumentException(
- string.Format(
"The specified type '{0}' could not be found, try using " +
- "ContainsAttribute(Type) first.",
- type.FullName));
+ "ContainsAttribute(Type) first.".Inject(type.FullName));
}
else
{
if (!this.attributeMap.TryGetValue(type, out value))
throw new ArgumentException(
- string.Format(
"The specified type '{0}' could not be found, try using " +
- "ContainsAttribute(Type) first.",
- type.FullName));
+ "ContainsAttribute(Type) first.".Inject(type.FullName));
}
@@ -453,6 +452,8 @@ namespace Lucene.Net.Util
/// <returns>
/// An instance of <see cref="IEnumerator{Type}"/>.
/// </returns>
+ [SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate",
+ Justification = "Due to microsoft's bad design, developers expect the Get[Type]Enumerator name convention. ")]
public IEnumerator<Type> GetAttributeTypesEnumerator()
{
return this.interfaceMap.Keys.GetEnumerator();
@@ -466,6 +467,8 @@ namespace Lucene.Net.Util
/// <returns>
/// An instance of <see cref="IEnumerator{AttributeBase}"/>.
/// </returns>
+ [SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate",
+ Justification = "Due to microsoft's bad design, developers expect the Get[Type]Enumerator name convention. ")]
public IEnumerator<AttributeBase> GetAttributeEnumerator()
{
return new AttributeEnumerator(this);
@@ -516,7 +519,7 @@ namespace Lucene.Net.Util
/// Thrown when a state contains ain attribute that is not found
/// within the current instance of <see cref="AttributeSource"/>
/// </exception>
- public void RestoreState(State state)
+ public void RestoreState(AttributeSourceState state)
{
if (state == null)
return;
@@ -537,20 +540,20 @@ namespace Lucene.Net.Util
/// Enumerates over the stored states in the <see cref="AttributeSource"/>
/// </summary>
/// <param name="invoke">The action to invoke on each state.</param>
- protected void ForEachState(Action<State> invoke)
+ protected void ForEachState(Action<AttributeSourceState> invoke)
{
for (var state = this.GetCurrentState(); state != null; state = state.Next)
invoke(state);
}
- private State GetCurrentState()
+ private AttributeSourceState GetCurrentState()
{
- State state = this.currentState[0];
+ AttributeSourceState state = this.currentState[0];
if (state != null || !this.HasAttributes)
return state;
- State current = state = this.currentState[0] = new State();
+ AttributeSourceState current = state = this.currentState[0] = new AttributeSourceState();
var enumerator = this.attributeMap.Values.GetEnumerator();
enumerator.MoveNext();
@@ -558,21 +561,19 @@ namespace Lucene.Net.Util
while (enumerator.MoveNext())
{
- current = current.Next = new State();
+ current = current.Next = new AttributeSourceState();
current.Attribute = enumerator.Current;
}
return state;
}
- private string CreateStateExceptionMessage(State state)
+ private string CreateStateExceptionMessage(AttributeSourceState state)
{
- return string.Format(
+ return
"The state contains an attribute of type '{0}' " +
- "that is currently not found within this instance of '{1}#{2}'. ",
- state.Attribute.GetType(),
- this.GetType().Name,
- this.GetHashCode());
+ "that is currently not found within this instance of '{1}#{2}'. "
+ .Inject(state.Attribute.GetType(), this.GetType().Name, this.GetHashCode());
}
/// <summary>
@@ -581,7 +582,7 @@ namespace Lucene.Net.Util
/// </summary>
public sealed class AttributeEnumerator : IEnumerator<AttributeBase>
{
- private State state;
+ private AttributeSourceState state;
private AttributeSource source;
/// <summary>
@@ -665,43 +666,5 @@ namespace Lucene.Net.Util
this.state = this.source.GetCurrentState();
}
}
-
-
- /// <summary>
- /// The state of an attribute source.
- /// </summary>
- public sealed class State : ICloneable, ICloneable<State>
- {
- /// <summary>
- /// Gets or sets the attribute.
- /// </summary>
- /// <value>The attribute.</value>
- public AttributeBase Attribute { get; set; }
-
- /// <summary>
- /// Gets or sets the next state.
- /// </summary>
- /// <value>The next.</value>
- public State Next { get; set; }
-
- /// <summary>
- /// Fully clones this instance.
- /// </summary>
- /// <returns>an instance of the cloned <see cref="State"/>.</returns>
- public State Clone()
- {
- State state = new State { Attribute = this.Attribute.Clone() };
-
- if (this.Next != null)
- state.Next = this.Next.Clone();
-
- return state;
- }
-
- object ICloneable.Clone()
- {
- return this.Clone();
- }
- }
}
}
Added: incubator/lucene.net/branches/Lucene.Net_4e/src/Lucene.Net/Util/AttributeSourceState.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_4e/src/Lucene.Net/Util/AttributeSourceState.cs?rev=1157250&view=auto
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_4e/src/Lucene.Net/Util/AttributeSourceState.cs (added)
+++ incubator/lucene.net/branches/Lucene.Net_4e/src/Lucene.Net/Util/AttributeSourceState.cs Fri Aug 12 21:00:55 2011
@@ -0,0 +1,73 @@
+// -----------------------------------------------------------------------
+// <copyright company="Apache" file="AttributeSourceState.cs">
+//
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements. See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// </copyright>
+// -----------------------------------------------------------------------
+
+namespace Lucene.Net.Util
+{
+ using System;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Text;
+ using Lucene.Net.Support;
+
+ /// <summary>
+ /// The state of an attribute source.
+ /// </summary>
+ /// <remarks>
+ /// <note>
+ /// In the java version this class is AttributeSource.State. However, the type is
+ /// public and does nothing that requires for it to be a nested class. Thus it
+ /// was moved outside of <see cref="AttributeSource"/> into its own class.
+ /// </note>
+ /// </remarks>
+ public sealed class AttributeSourceState : ICloneable, ICloneable<AttributeSourceState>
+ {
+ /// <summary>
+ /// Gets or sets the attribute.
+ /// </summary>
+ /// <value>The attribute.</value>
+ public AttributeBase Attribute { get; set; }
+
+ /// <summary>
+ /// Gets or sets the next state.
+ /// </summary>
+ /// <value>The next.</value>
+ public AttributeSourceState Next { get; set; }
+
+ /// <summary>
+ /// Fully clones this instance.
+ /// </summary>
+ /// <returns>an instance of the cloned <see cref="AttributeSourceState"/>.</returns>
+ public AttributeSourceState Clone()
+ {
+ AttributeSourceState state = new AttributeSourceState { Attribute = this.Attribute.Clone() };
+
+ if (this.Next != null)
+ state.Next = this.Next.Clone();
+
+ return state;
+ }
+
+ object ICloneable.Clone()
+ {
+ return this.Clone();
+ }
+ }
+}
\ No newline at end of file
Modified: incubator/lucene.net/branches/Lucene.Net_4e/src/Lucene.Net/Util/BytesRef.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_4e/src/Lucene.Net/Util/BytesRef.cs?rev=1157250&r1=1157249&r2=1157250&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_4e/src/Lucene.Net/Util/BytesRef.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net_4e/src/Lucene.Net/Util/BytesRef.cs Fri Aug 12 21:00:55 2011
@@ -28,9 +28,56 @@ namespace Lucene.Net.Util
/// <summary>
/// TODO: port
+ /// this class has methods that are not valid to void FxCop.
/// </summary>
public sealed class BytesRef : IComparable<BytesRef>
{
+ private byte[] reference = new byte[] { };
+
+ /// <summary>
+ /// Implements the operator !=.
+ /// </summary>
+ /// <param name="x">The x.</param>
+ /// <param name="y">The y.</param>
+ /// <returns>The result of the operator.</returns>
+ public static bool operator !=(BytesRef x, BytesRef y)
+ {
+ return x.reference != y.reference;
+ }
+
+ /// <summary>
+ /// Implements the operator ==.
+ /// </summary>
+ /// <param name="x">The x.</param>
+ /// <param name="y">The y.</param>
+ /// <returns>The result of the operator.</returns>
+ public static bool operator ==(BytesRef x, BytesRef y)
+ {
+ return x.reference == y.reference;
+ }
+
+ /// <summary>
+ /// Implements the operator <.
+ /// </summary>
+ /// <param name="x">The x.</param>
+ /// <param name="y">The y.</param>
+ /// <returns>The result of the operator.</returns>
+ public static bool operator <(BytesRef x, BytesRef y)
+ {
+ return x.reference.Length < y.reference.Length;
+ }
+
+ /// <summary>
+ /// Implements the operator >.
+ /// </summary>
+ /// <param name="x">The x.</param>
+ /// <param name="y">The y.</param>
+ /// <returns>The result of the operator.</returns>
+ public static bool operator >(BytesRef x, BytesRef y)
+ {
+ return x.reference.Length < y.reference.Length;
+ }
+
/// <summary>
/// Compares this instance to the other <see cref="BytesRef"/> instance.
/// </summary>
@@ -40,5 +87,28 @@ namespace Lucene.Net.Util
{
throw new NotImplementedException();
}
+
+ /// <summary>
+ /// Returns a hash code for this instance.
+ /// </summary>
+ /// <returns>
+ /// A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.
+ /// </returns>
+ public override int GetHashCode()
+ {
+ return this.reference.GetHashCode();
+ }
+
+ /// <summary>
+ /// Determines whether the specified <see cref="System.Object"/> is equal to this instance.
+ /// </summary>
+ /// <param name="obj">The <see cref="System.Object"/> to compare with this instance.</param>
+ /// <returns>
+ /// <c>true</c> if the specified <see cref="System.Object"/> is equal to this instance; otherwise, <c>false</c>.
+ /// </returns>
+ public override bool Equals(object obj)
+ {
+ return this.reference.Equals(obj);
+ }
}
}
\ No newline at end of file