Author: aroush Date: Tue Jun 24 19:49:43 2008 New Revision: 671400 URL: http://svn.apache.org/viewvc?rev=671400&view=rev Log: Release: Apache Lucene.Net.2.3.1 build 001 "Alpha" Modified: incubator/lucene.net/trunk/C#/src/Lucene.Net/Util/BitVector.cs incubator/lucene.net/trunk/C#/src/Lucene.Net/Util/Constants.cs incubator/lucene.net/trunk/C#/src/Lucene.Net/Util/Package.html incubator/lucene.net/trunk/C#/src/Lucene.Net/Util/PriorityQueue.cs incubator/lucene.net/trunk/C#/src/Lucene.Net/Util/StringHelper.cs incubator/lucene.net/trunk/C#/src/Lucene.Net/Util/ToStringUtils.cs Modified: incubator/lucene.net/trunk/C#/src/Lucene.Net/Util/BitVector.cs URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Lucene.Net/Util/BitVector.cs?rev=671400&r1=671399&r2=671400&view=diff ============================================================================== --- incubator/lucene.net/trunk/C#/src/Lucene.Net/Util/BitVector.cs (original) +++ incubator/lucene.net/trunk/C#/src/Lucene.Net/Util/BitVector.cs Tue Jun 24 19:49:43 2008 @@ -33,9 +33,7 @@ ///
  • store and load, as bit set or d-gaps, depending on sparseness;
  • /// /// - /// Doug Cutting - /// - /// $Id: BitVector.java 494136 2007-01-08 18:11:08Z mikemccand $ + /// $Id: BitVector.java 564236 2007-08-09 15:21:19Z gsingers $ /// public sealed class BitVector { Modified: incubator/lucene.net/trunk/C#/src/Lucene.Net/Util/Constants.cs URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Lucene.Net/Util/Constants.cs?rev=671400&r1=671399&r2=671400&view=diff ============================================================================== --- incubator/lucene.net/trunk/C#/src/Lucene.Net/Util/Constants.cs (original) +++ incubator/lucene.net/trunk/C#/src/Lucene.Net/Util/Constants.cs Tue Jun 24 19:49:43 2008 @@ -20,28 +20,11 @@ namespace Lucene.Net.Util { - /// 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. - /// - /// Some useful constants. /// + /// /// - /// Doug Cutting - /// - /// $Id: Constants.java 472959 2006-11-09 16:21:50Z yonik $ + /// $Id: Constants.java 564236 2007-08-09 15:21:19Z gsingers $ /// /// Modified: incubator/lucene.net/trunk/C#/src/Lucene.Net/Util/Package.html URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Lucene.Net/Util/Package.html?rev=671400&r1=671399&r2=671400&view=diff ============================================================================== --- incubator/lucene.net/trunk/C#/src/Lucene.Net/Util/Package.html (original) +++ incubator/lucene.net/trunk/C#/src/Lucene.Net/Util/Package.html Tue Jun 24 19:49:43 2008 @@ -1,10 +1,10 @@ - - - - - - - -Some utility classes. - - + + + + + + + +Some utility classes. + + Modified: incubator/lucene.net/trunk/C#/src/Lucene.Net/Util/PriorityQueue.cs URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Lucene.Net/Util/PriorityQueue.cs?rev=671400&r1=671399&r2=671400&view=diff ============================================================================== --- incubator/lucene.net/trunk/C#/src/Lucene.Net/Util/PriorityQueue.cs (original) +++ incubator/lucene.net/trunk/C#/src/Lucene.Net/Util/PriorityQueue.cs Tue Jun 24 19:49:43 2008 @@ -20,31 +20,15 @@ namespace Lucene.Net.Util { - /// 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. - /// - /// A PriorityQueue maintains a partial ordering of its elements such that the /// least element can always be found in constant time. Put()'s and pop()'s /// require log(size) time. /// public abstract class PriorityQueue { - private System.Object[] heap; private int size; private int maxSize; + protected internal System.Object[] heap; /// Determines the ordering of objects in this priority queue. Subclasses /// must define this one method. @@ -55,14 +39,19 @@ protected internal void Initialize(int maxSize) { size = 0; - int heapSize = maxSize + 1; + int heapSize; + if (0 == maxSize) + // We allocate 1 extra to avoid if statement in top() + heapSize = 2; + else + heapSize = maxSize + 1; heap = new System.Object[heapSize]; this.maxSize = maxSize; } /// Adds an Object to a PriorityQueue in log(size) time. /// If one tries to add more objects than maxSize from initialize - /// a SystemException (ArrayIndexOutOfBound) is thrown. + /// a RuntimeException (ArrayIndexOutOfBound) is thrown. /// public void Put(System.Object element) { @@ -74,34 +63,51 @@ /// Adds element to the PriorityQueue in log(size) time if either /// the PriorityQueue is not full, or not lessThan(element, top()). /// - /// element + /// /// /// true if element is added, false otherwise. /// public virtual bool Insert(System.Object element) { + return InsertWithOverflow(element) != element; + } + + /// insertWithOverflow() is the same as insert() except its + /// return value: it returns the object (if any) that was + /// dropped off the heap because it was full. This can be + /// the given parameter (in case it is smaller than the + /// full heap's minimum, and couldn't be added), or another + /// object that was previously the smallest value in the + /// heap and now has been replaced by a larger one, or null + /// if the queue wasn't yet full with maxSize elements. + /// + public virtual System.Object InsertWithOverflow(System.Object element) + { if (size < maxSize) { Put(element); - return true; + return null; } - else if (size > 0 && !LessThan(element, Top())) + else if (size > 0 && !LessThan(element, heap[1])) { + System.Object ret = heap[1]; heap[1] = element; AdjustTop(); - return true; + return ret; } else - return false; + { + return element; + } } /// Returns the least element of the PriorityQueue in constant time. public System.Object Top() { - if (size > 0) - return heap[1]; - else - return null; + // We don't need to check size here: if maxSize is 0, + // then heap is length 2 array with both entries null. + // If size is 0 then heap[1] is already null. + return heap[1]; } /// Removes and returns the least element of the PriorityQueue in log(size) @@ -134,7 +140,6 @@ DownHeap(); } - /// Returns the number of elements currently stored in the PriorityQueue. public int Size() { Modified: incubator/lucene.net/trunk/C#/src/Lucene.Net/Util/StringHelper.cs URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Lucene.Net/Util/StringHelper.cs?rev=671400&r1=671399&r2=671400&view=diff ============================================================================== --- incubator/lucene.net/trunk/C#/src/Lucene.Net/Util/StringHelper.cs (original) +++ incubator/lucene.net/trunk/C#/src/Lucene.Net/Util/StringHelper.cs Tue Jun 24 19:49:43 2008 @@ -42,7 +42,7 @@ { int len1 = s1.Length; int len2 = s2.Length; - int len = len1 < len2?len1:len2; + int len = len1 < len2 ? len1:len2; for (int i = 0; i < len; i++) { if (s1[i] != s2[i]) Modified: incubator/lucene.net/trunk/C#/src/Lucene.Net/Util/ToStringUtils.cs URL: http://svn.apache.org/viewvc/incubator/lucene.net/trunk/C%23/src/Lucene.Net/Util/ToStringUtils.cs?rev=671400&r1=671399&r2=671400&view=diff ============================================================================== --- incubator/lucene.net/trunk/C#/src/Lucene.Net/Util/ToStringUtils.cs (original) +++ incubator/lucene.net/trunk/C#/src/Lucene.Net/Util/ToStringUtils.cs Tue Jun 24 19:49:43 2008 @@ -22,6 +22,7 @@ public class ToStringUtils { + /// for printing boost only if not 1.0 public static System.String Boost(float boost) { if (boost != 1.0f)