Lucene.Net.TestFramework: Renamed Codecs\compressing\ to Codecs\Compressing\
Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/362f0d30 Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/362f0d30 Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/362f0d30 Branch: refs/heads/api-work Commit: 362f0d30d0cc0c1e9689df23d38c7a5f22b46b89 Parents: 77e95cc Author: Shad Storhaug <[email protected]> Authored: Sun Feb 26 03:08:22 2017 +0700 Committer: Shad Storhaug <[email protected]> Committed: Mon Feb 27 06:17:55 2017 +0700 ---------------------------------------------------------------------- .../Codecs/Compressing/CompressingCodec.cs | 112 ++++++++++++++++++ .../Compressing/Dummy/DummyCompressingCodec.cs | 113 +++++++++++++++++++ .../Codecs/Compressing/FastCompressingCodec.cs | 47 ++++++++ .../FastDecompressionCompressingCodec.cs | 47 ++++++++ .../HighCompressionCompressingCodec.cs | 47 ++++++++ .../Codecs/compressing/CompressingCodec.cs | 112 ------------------ .../Codecs/compressing/FastCompressingCodec.cs | 47 -------- .../FastDecompressionCompressingCodec.cs | 47 -------- .../HighCompressionCompressingCodec.cs | 47 -------- .../compressing/dummy/DummyCompressingCodec.cs | 113 ------------------- .../Lucene.Net.TestFramework.csproj | 10 +- 11 files changed, 371 insertions(+), 371 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/lucenenet/blob/362f0d30/src/Lucene.Net.TestFramework/Codecs/Compressing/CompressingCodec.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.TestFramework/Codecs/Compressing/CompressingCodec.cs b/src/Lucene.Net.TestFramework/Codecs/Compressing/CompressingCodec.cs new file mode 100644 index 0000000..74bf859 --- /dev/null +++ b/src/Lucene.Net.TestFramework/Codecs/Compressing/CompressingCodec.cs @@ -0,0 +1,112 @@ +using System; + +namespace Lucene.Net.Codecs.Compressing +{ + using Lucene.Net.Randomized.Generators; + + /* + * 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. + */ + + using DummyCompressingCodec = Lucene.Net.Codecs.Compressing.Dummy.DummyCompressingCodec; + using Lucene46Codec = Lucene.Net.Codecs.Lucene46.Lucene46Codec; + + //using RandomInts = com.carrotsearch.randomizedtesting.generators.RandomInts; + + /// <summary> + /// A codec that uses <seealso cref="CompressingStoredFieldsFormat"/> for its stored + /// fields and delegates to <seealso cref="Lucene46Codec"/> for everything else. + /// </summary> + public abstract class CompressingCodec : FilterCodec + { + /// <summary> + /// Create a random instance. + /// </summary> + public static CompressingCodec RandomInstance(Random random, int chunkSize, bool withSegmentSuffix) + { + switch (random.Next(4)) + { + case 0: + return new FastCompressingCodec(chunkSize, withSegmentSuffix); + + case 1: + return new FastDecompressionCompressingCodec(chunkSize, withSegmentSuffix); + + case 2: + return new HighCompressionCompressingCodec(chunkSize, withSegmentSuffix); + + case 3: + return new DummyCompressingCodec(chunkSize, withSegmentSuffix); + + default: + throw new InvalidOperationException(); + } + } + + /// <summary> + /// Creates a random <seealso cref="CompressingCodec"/> that is using an empty segment + /// suffix + /// </summary> + public static CompressingCodec RandomInstance(Random random) + { + return RandomInstance(random, RandomInts.NextIntBetween(random, 1, 500), false); + } + + /// <summary> + /// Creates a random <seealso cref="CompressingCodec"/> that is using a segment suffix + /// </summary> + public static CompressingCodec RandomInstance(Random random, bool withSegmentSuffix) + { + return RandomInstance(random, RandomInts.NextIntBetween(random, 1, 500), withSegmentSuffix); + } + + private readonly CompressingStoredFieldsFormat StoredFieldsFormat_Renamed; + private readonly CompressingTermVectorsFormat TermVectorsFormat_Renamed; + + /// <summary> + /// Creates a compressing codec with a given segment suffix + /// </summary> + protected CompressingCodec(string segmentSuffix, CompressionMode compressionMode, int chunkSize) + : base(new Lucene46Codec()) + { + this.StoredFieldsFormat_Renamed = new CompressingStoredFieldsFormat(this.Name, segmentSuffix, compressionMode, chunkSize); + this.TermVectorsFormat_Renamed = new CompressingTermVectorsFormat(this.Name, segmentSuffix, compressionMode, chunkSize); + } + + /// <summary> + /// Creates a compressing codec with an empty segment suffix + /// </summary> + protected CompressingCodec(CompressionMode compressionMode, int chunkSize) + : this("", compressionMode, chunkSize) + { + } + + public override StoredFieldsFormat StoredFieldsFormat + { + get { return StoredFieldsFormat_Renamed; } + } + + public override TermVectorsFormat TermVectorsFormat + { + get { return TermVectorsFormat_Renamed; } + } + + public override string ToString() + { + return Name + "(storedFieldsFormat=" + StoredFieldsFormat_Renamed + ", termVectorsFormat=" + TermVectorsFormat_Renamed + ")"; + } + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/lucenenet/blob/362f0d30/src/Lucene.Net.TestFramework/Codecs/Compressing/Dummy/DummyCompressingCodec.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.TestFramework/Codecs/Compressing/Dummy/DummyCompressingCodec.cs b/src/Lucene.Net.TestFramework/Codecs/Compressing/Dummy/DummyCompressingCodec.cs new file mode 100644 index 0000000..01ecf30 --- /dev/null +++ b/src/Lucene.Net.TestFramework/Codecs/Compressing/Dummy/DummyCompressingCodec.cs @@ -0,0 +1,113 @@ +using System.Diagnostics; + +namespace Lucene.Net.Codecs.Compressing.Dummy +{ + using ArrayUtil = Lucene.Net.Util.ArrayUtil; + using BytesRef = Lucene.Net.Util.BytesRef; + + /* + * 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. + */ + + using DataInput = Lucene.Net.Store.DataInput; + using DataOutput = Lucene.Net.Store.DataOutput; + + /// <summary> + /// CompressionCodec that does not compress data, useful for testing. </summary> + // In its own package to make sure the oal.codecs.compressing classes are + // visible enough to let people write their own CompressionMode + [CodecName("DummyCompressingStoredFields")] + public class DummyCompressingCodec : CompressingCodec + { + public static readonly CompressionMode DUMMY = new CompressionModeAnonymousInnerClassHelper(); + + private class CompressionModeAnonymousInnerClassHelper : CompressionMode + { + public CompressionModeAnonymousInnerClassHelper() + { + } + + public override Compressor NewCompressor() + { + return DUMMY_COMPRESSOR; + } + + public override Decompressor NewDecompressor() + { + return DUMMY_DECOMPRESSOR; + } + + public override string ToString() + { + return "DUMMY"; + } + } + + private static readonly Decompressor DUMMY_DECOMPRESSOR = new DecompressorAnonymousInnerClassHelper(); + + private class DecompressorAnonymousInnerClassHelper : Decompressor + { + public DecompressorAnonymousInnerClassHelper() + { + } + + public override void Decompress(DataInput @in, int originalLength, int offset, int length, BytesRef bytes) + { + Debug.Assert(offset + length <= originalLength); + if (bytes.Bytes.Length < originalLength) + { + bytes.Bytes = new byte[ArrayUtil.Oversize(originalLength, 1)]; + } + @in.ReadBytes(bytes.Bytes, 0, offset + length); + bytes.Offset = offset; + bytes.Length = length; + } + + public override object Clone() + { + return this; + } + } + + private static readonly Compressor DUMMY_COMPRESSOR = new CompressorAnonymousInnerClassHelper(); + + private class CompressorAnonymousInnerClassHelper : Compressor + { + public CompressorAnonymousInnerClassHelper() + { + } + + public override void Compress(byte[] bytes, int off, int len, DataOutput @out) + { + @out.WriteBytes(bytes, off, len); + } + } + + /// <summary> + /// Constructor that allows to configure the chunk size. </summary> + public DummyCompressingCodec(int chunkSize, bool withSegmentSuffix) + : base(withSegmentSuffix ? "DummyCompressingStoredFields" : "", DUMMY, chunkSize) + { + } + + /// <summary> + /// Default constructor. </summary> + public DummyCompressingCodec() + : this(1 << 14, false) + { + } + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/lucenenet/blob/362f0d30/src/Lucene.Net.TestFramework/Codecs/Compressing/FastCompressingCodec.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.TestFramework/Codecs/Compressing/FastCompressingCodec.cs b/src/Lucene.Net.TestFramework/Codecs/Compressing/FastCompressingCodec.cs new file mode 100644 index 0000000..b574080 --- /dev/null +++ b/src/Lucene.Net.TestFramework/Codecs/Compressing/FastCompressingCodec.cs @@ -0,0 +1,47 @@ +namespace Lucene.Net.Codecs.Compressing +{ + using Lucene42NormsFormat = Lucene.Net.Codecs.Lucene42.Lucene42NormsFormat; + using PackedInt32s = Lucene.Net.Util.Packed.PackedInt32s; + + /* + * 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. + */ + + /// <summary> + /// CompressionCodec that uses <seealso cref="CompressionMode#FAST"/> </summary> + [CodecName("FastCompressingStoredFields")] + public class FastCompressingCodec : CompressingCodec + { + /// <summary> + /// Constructor that allows to configure the chunk size. </summary> + public FastCompressingCodec(int chunkSize, bool withSegmentSuffix) + : base(withSegmentSuffix ? "FastCompressingStoredFields" : "", CompressionMode.FAST, chunkSize) + { + } + + /// <summary> + /// Default constructor. </summary> + public FastCompressingCodec() + : this(1 << 14, false) + { + } + + public override NormsFormat NormsFormat + { + get { return new Lucene42NormsFormat(PackedInt32s.FAST); } + } + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/lucenenet/blob/362f0d30/src/Lucene.Net.TestFramework/Codecs/Compressing/FastDecompressionCompressingCodec.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.TestFramework/Codecs/Compressing/FastDecompressionCompressingCodec.cs b/src/Lucene.Net.TestFramework/Codecs/Compressing/FastDecompressionCompressingCodec.cs new file mode 100644 index 0000000..b5e6df3 --- /dev/null +++ b/src/Lucene.Net.TestFramework/Codecs/Compressing/FastDecompressionCompressingCodec.cs @@ -0,0 +1,47 @@ +namespace Lucene.Net.Codecs.Compressing +{ + using Lucene42NormsFormat = Lucene.Net.Codecs.Lucene42.Lucene42NormsFormat; + using PackedInt32s = Lucene.Net.Util.Packed.PackedInt32s; + + /* + * 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. + */ + + /// <summary> + /// CompressionCodec that uses <seealso cref="CompressionMode#FAST_DECOMPRESSION"/> </summary> + [CodecName("FastDecompressionCompressingStoredFields")] + public class FastDecompressionCompressingCodec : CompressingCodec + { + /// <summary> + /// Constructor that allows to configure the chunk size. </summary> + public FastDecompressionCompressingCodec(int chunkSize, bool withSegmentSuffix) + : base(withSegmentSuffix ? "FastDecompressionCompressingStoredFields" : "", CompressionMode.FAST_DECOMPRESSION, chunkSize) + { + } + + /// <summary> + /// Default constructor. </summary> + public FastDecompressionCompressingCodec() + : this(1 << 14, false) + { + } + + public override NormsFormat NormsFormat + { + get { return new Lucene42NormsFormat(PackedInt32s.DEFAULT); } + } + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/lucenenet/blob/362f0d30/src/Lucene.Net.TestFramework/Codecs/Compressing/HighCompressionCompressingCodec.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.TestFramework/Codecs/Compressing/HighCompressionCompressingCodec.cs b/src/Lucene.Net.TestFramework/Codecs/Compressing/HighCompressionCompressingCodec.cs new file mode 100644 index 0000000..95f78b4 --- /dev/null +++ b/src/Lucene.Net.TestFramework/Codecs/Compressing/HighCompressionCompressingCodec.cs @@ -0,0 +1,47 @@ +namespace Lucene.Net.Codecs.Compressing +{ + using Lucene42NormsFormat = Lucene.Net.Codecs.Lucene42.Lucene42NormsFormat; + using PackedInt32s = Lucene.Net.Util.Packed.PackedInt32s; + + /* + * 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. + */ + + /// <summary> + /// CompressionCodec that uses <seealso cref="CompressionMode#HIGH_COMPRESSION"/> </summary> + [CodecName("HighCompressionCompressingStoredFields")] + public class HighCompressionCompressingCodec : CompressingCodec + { + /// <summary> + /// Constructor that allows to configure the chunk size. </summary> + public HighCompressionCompressingCodec(int chunkSize, bool withSegmentSuffix) + : base(withSegmentSuffix ? "HighCompressionCompressingStoredFields" : "", CompressionMode.HIGH_COMPRESSION, chunkSize) + { + } + + /// <summary> + /// Default constructor. </summary> + public HighCompressionCompressingCodec() + : this(1 << 14, false) + { + } + + public override NormsFormat NormsFormat + { + get { return new Lucene42NormsFormat(PackedInt32s.COMPACT); } + } + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/lucenenet/blob/362f0d30/src/Lucene.Net.TestFramework/Codecs/compressing/CompressingCodec.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.TestFramework/Codecs/compressing/CompressingCodec.cs b/src/Lucene.Net.TestFramework/Codecs/compressing/CompressingCodec.cs deleted file mode 100644 index f5f75bd..0000000 --- a/src/Lucene.Net.TestFramework/Codecs/compressing/CompressingCodec.cs +++ /dev/null @@ -1,112 +0,0 @@ -using System; - -namespace Lucene.Net.Codecs.Compressing -{ - using Lucene.Net.Randomized.Generators; - - /* - * 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. - */ - - using DummyCompressingCodec = Lucene.Net.Codecs.Compressing.dummy.DummyCompressingCodec; - using Lucene46Codec = Lucene.Net.Codecs.Lucene46.Lucene46Codec; - - //using RandomInts = com.carrotsearch.randomizedtesting.generators.RandomInts; - - /// <summary> - /// A codec that uses <seealso cref="CompressingStoredFieldsFormat"/> for its stored - /// fields and delegates to <seealso cref="Lucene46Codec"/> for everything else. - /// </summary> - public abstract class CompressingCodec : FilterCodec - { - /// <summary> - /// Create a random instance. - /// </summary> - public static CompressingCodec RandomInstance(Random random, int chunkSize, bool withSegmentSuffix) - { - switch (random.Next(4)) - { - case 0: - return new FastCompressingCodec(chunkSize, withSegmentSuffix); - - case 1: - return new FastDecompressionCompressingCodec(chunkSize, withSegmentSuffix); - - case 2: - return new HighCompressionCompressingCodec(chunkSize, withSegmentSuffix); - - case 3: - return new DummyCompressingCodec(chunkSize, withSegmentSuffix); - - default: - throw new InvalidOperationException(); - } - } - - /// <summary> - /// Creates a random <seealso cref="CompressingCodec"/> that is using an empty segment - /// suffix - /// </summary> - public static CompressingCodec RandomInstance(Random random) - { - return RandomInstance(random, RandomInts.NextIntBetween(random, 1, 500), false); - } - - /// <summary> - /// Creates a random <seealso cref="CompressingCodec"/> that is using a segment suffix - /// </summary> - public static CompressingCodec RandomInstance(Random random, bool withSegmentSuffix) - { - return RandomInstance(random, RandomInts.NextIntBetween(random, 1, 500), withSegmentSuffix); - } - - private readonly CompressingStoredFieldsFormat StoredFieldsFormat_Renamed; - private readonly CompressingTermVectorsFormat TermVectorsFormat_Renamed; - - /// <summary> - /// Creates a compressing codec with a given segment suffix - /// </summary> - protected CompressingCodec(string segmentSuffix, CompressionMode compressionMode, int chunkSize) - : base(new Lucene46Codec()) - { - this.StoredFieldsFormat_Renamed = new CompressingStoredFieldsFormat(this.Name, segmentSuffix, compressionMode, chunkSize); - this.TermVectorsFormat_Renamed = new CompressingTermVectorsFormat(this.Name, segmentSuffix, compressionMode, chunkSize); - } - - /// <summary> - /// Creates a compressing codec with an empty segment suffix - /// </summary> - protected CompressingCodec(CompressionMode compressionMode, int chunkSize) - : this("", compressionMode, chunkSize) - { - } - - public override StoredFieldsFormat StoredFieldsFormat - { - get { return StoredFieldsFormat_Renamed; } - } - - public override TermVectorsFormat TermVectorsFormat - { - get { return TermVectorsFormat_Renamed; } - } - - public override string ToString() - { - return Name + "(storedFieldsFormat=" + StoredFieldsFormat_Renamed + ", termVectorsFormat=" + TermVectorsFormat_Renamed + ")"; - } - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/lucenenet/blob/362f0d30/src/Lucene.Net.TestFramework/Codecs/compressing/FastCompressingCodec.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.TestFramework/Codecs/compressing/FastCompressingCodec.cs b/src/Lucene.Net.TestFramework/Codecs/compressing/FastCompressingCodec.cs deleted file mode 100644 index b574080..0000000 --- a/src/Lucene.Net.TestFramework/Codecs/compressing/FastCompressingCodec.cs +++ /dev/null @@ -1,47 +0,0 @@ -namespace Lucene.Net.Codecs.Compressing -{ - using Lucene42NormsFormat = Lucene.Net.Codecs.Lucene42.Lucene42NormsFormat; - using PackedInt32s = Lucene.Net.Util.Packed.PackedInt32s; - - /* - * 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. - */ - - /// <summary> - /// CompressionCodec that uses <seealso cref="CompressionMode#FAST"/> </summary> - [CodecName("FastCompressingStoredFields")] - public class FastCompressingCodec : CompressingCodec - { - /// <summary> - /// Constructor that allows to configure the chunk size. </summary> - public FastCompressingCodec(int chunkSize, bool withSegmentSuffix) - : base(withSegmentSuffix ? "FastCompressingStoredFields" : "", CompressionMode.FAST, chunkSize) - { - } - - /// <summary> - /// Default constructor. </summary> - public FastCompressingCodec() - : this(1 << 14, false) - { - } - - public override NormsFormat NormsFormat - { - get { return new Lucene42NormsFormat(PackedInt32s.FAST); } - } - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/lucenenet/blob/362f0d30/src/Lucene.Net.TestFramework/Codecs/compressing/FastDecompressionCompressingCodec.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.TestFramework/Codecs/compressing/FastDecompressionCompressingCodec.cs b/src/Lucene.Net.TestFramework/Codecs/compressing/FastDecompressionCompressingCodec.cs deleted file mode 100644 index b5e6df3..0000000 --- a/src/Lucene.Net.TestFramework/Codecs/compressing/FastDecompressionCompressingCodec.cs +++ /dev/null @@ -1,47 +0,0 @@ -namespace Lucene.Net.Codecs.Compressing -{ - using Lucene42NormsFormat = Lucene.Net.Codecs.Lucene42.Lucene42NormsFormat; - using PackedInt32s = Lucene.Net.Util.Packed.PackedInt32s; - - /* - * 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. - */ - - /// <summary> - /// CompressionCodec that uses <seealso cref="CompressionMode#FAST_DECOMPRESSION"/> </summary> - [CodecName("FastDecompressionCompressingStoredFields")] - public class FastDecompressionCompressingCodec : CompressingCodec - { - /// <summary> - /// Constructor that allows to configure the chunk size. </summary> - public FastDecompressionCompressingCodec(int chunkSize, bool withSegmentSuffix) - : base(withSegmentSuffix ? "FastDecompressionCompressingStoredFields" : "", CompressionMode.FAST_DECOMPRESSION, chunkSize) - { - } - - /// <summary> - /// Default constructor. </summary> - public FastDecompressionCompressingCodec() - : this(1 << 14, false) - { - } - - public override NormsFormat NormsFormat - { - get { return new Lucene42NormsFormat(PackedInt32s.DEFAULT); } - } - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/lucenenet/blob/362f0d30/src/Lucene.Net.TestFramework/Codecs/compressing/HighCompressionCompressingCodec.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.TestFramework/Codecs/compressing/HighCompressionCompressingCodec.cs b/src/Lucene.Net.TestFramework/Codecs/compressing/HighCompressionCompressingCodec.cs deleted file mode 100644 index 95f78b4..0000000 --- a/src/Lucene.Net.TestFramework/Codecs/compressing/HighCompressionCompressingCodec.cs +++ /dev/null @@ -1,47 +0,0 @@ -namespace Lucene.Net.Codecs.Compressing -{ - using Lucene42NormsFormat = Lucene.Net.Codecs.Lucene42.Lucene42NormsFormat; - using PackedInt32s = Lucene.Net.Util.Packed.PackedInt32s; - - /* - * 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. - */ - - /// <summary> - /// CompressionCodec that uses <seealso cref="CompressionMode#HIGH_COMPRESSION"/> </summary> - [CodecName("HighCompressionCompressingStoredFields")] - public class HighCompressionCompressingCodec : CompressingCodec - { - /// <summary> - /// Constructor that allows to configure the chunk size. </summary> - public HighCompressionCompressingCodec(int chunkSize, bool withSegmentSuffix) - : base(withSegmentSuffix ? "HighCompressionCompressingStoredFields" : "", CompressionMode.HIGH_COMPRESSION, chunkSize) - { - } - - /// <summary> - /// Default constructor. </summary> - public HighCompressionCompressingCodec() - : this(1 << 14, false) - { - } - - public override NormsFormat NormsFormat - { - get { return new Lucene42NormsFormat(PackedInt32s.COMPACT); } - } - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/lucenenet/blob/362f0d30/src/Lucene.Net.TestFramework/Codecs/compressing/dummy/DummyCompressingCodec.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.TestFramework/Codecs/compressing/dummy/DummyCompressingCodec.cs b/src/Lucene.Net.TestFramework/Codecs/compressing/dummy/DummyCompressingCodec.cs deleted file mode 100644 index 4fd416e..0000000 --- a/src/Lucene.Net.TestFramework/Codecs/compressing/dummy/DummyCompressingCodec.cs +++ /dev/null @@ -1,113 +0,0 @@ -using System.Diagnostics; - -namespace Lucene.Net.Codecs.Compressing.dummy -{ - using ArrayUtil = Lucene.Net.Util.ArrayUtil; - using BytesRef = Lucene.Net.Util.BytesRef; - - /* - * 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. - */ - - using DataInput = Lucene.Net.Store.DataInput; - using DataOutput = Lucene.Net.Store.DataOutput; - - /// <summary> - /// CompressionCodec that does not compress data, useful for testing. </summary> - // In its own package to make sure the oal.codecs.compressing classes are - // visible enough to let people write their own CompressionMode - [CodecName("DummyCompressingStoredFields")] - public class DummyCompressingCodec : CompressingCodec - { - public static readonly CompressionMode DUMMY = new CompressionModeAnonymousInnerClassHelper(); - - private class CompressionModeAnonymousInnerClassHelper : CompressionMode - { - public CompressionModeAnonymousInnerClassHelper() - { - } - - public override Compressor NewCompressor() - { - return DUMMY_COMPRESSOR; - } - - public override Decompressor NewDecompressor() - { - return DUMMY_DECOMPRESSOR; - } - - public override string ToString() - { - return "DUMMY"; - } - } - - private static readonly Decompressor DUMMY_DECOMPRESSOR = new DecompressorAnonymousInnerClassHelper(); - - private class DecompressorAnonymousInnerClassHelper : Decompressor - { - public DecompressorAnonymousInnerClassHelper() - { - } - - public override void Decompress(DataInput @in, int originalLength, int offset, int length, BytesRef bytes) - { - Debug.Assert(offset + length <= originalLength); - if (bytes.Bytes.Length < originalLength) - { - bytes.Bytes = new byte[ArrayUtil.Oversize(originalLength, 1)]; - } - @in.ReadBytes(bytes.Bytes, 0, offset + length); - bytes.Offset = offset; - bytes.Length = length; - } - - public override object Clone() - { - return this; - } - } - - private static readonly Compressor DUMMY_COMPRESSOR = new CompressorAnonymousInnerClassHelper(); - - private class CompressorAnonymousInnerClassHelper : Compressor - { - public CompressorAnonymousInnerClassHelper() - { - } - - public override void Compress(byte[] bytes, int off, int len, DataOutput @out) - { - @out.WriteBytes(bytes, off, len); - } - } - - /// <summary> - /// Constructor that allows to configure the chunk size. </summary> - public DummyCompressingCodec(int chunkSize, bool withSegmentSuffix) - : base(withSegmentSuffix ? "DummyCompressingStoredFields" : "", DUMMY, chunkSize) - { - } - - /// <summary> - /// Default constructor. </summary> - public DummyCompressingCodec() - : this(1 << 14, false) - { - } - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/lucenenet/blob/362f0d30/src/Lucene.Net.TestFramework/Lucene.Net.TestFramework.csproj ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.TestFramework/Lucene.Net.TestFramework.csproj b/src/Lucene.Net.TestFramework/Lucene.Net.TestFramework.csproj index f789033..3d3fd87 100644 --- a/src/Lucene.Net.TestFramework/Lucene.Net.TestFramework.csproj +++ b/src/Lucene.Net.TestFramework/Lucene.Net.TestFramework.csproj @@ -141,19 +141,19 @@ <SubType>Code</SubType> </Compile> <Compile Include="Codecs\Bloom\TestBloomFilteredLucene41Postings.cs" /> - <Compile Include="Codecs\compressing\CompressingCodec.cs"> + <Compile Include="Codecs\Compressing\CompressingCodec.cs"> <SubType>Code</SubType> </Compile> - <Compile Include="Codecs\compressing\dummy\DummyCompressingCodec.cs"> + <Compile Include="Codecs\Compressing\Dummy\DummyCompressingCodec.cs"> <SubType>Code</SubType> </Compile> - <Compile Include="Codecs\compressing\FastCompressingCodec.cs"> + <Compile Include="Codecs\Compressing\FastCompressingCodec.cs"> <SubType>Code</SubType> </Compile> - <Compile Include="Codecs\compressing\FastDecompressionCompressingCodec.cs"> + <Compile Include="Codecs\Compressing\FastDecompressionCompressingCodec.cs"> <SubType>Code</SubType> </Compile> - <Compile Include="Codecs\compressing\HighCompressionCompressingCodec.cs"> + <Compile Include="Codecs\Compressing\HighCompressionCompressingCodec.cs"> <SubType>Code</SubType> </Compile> <Compile Include="Codecs\lucene3x\PreFlexRWCodec.cs">
