Namespace Lucene.Net.Support
Classes
Arrays
AssemblyExtensions
AssemblyUtils
Methods for working with Assemblies.
AssemblyUtils.DotNetFrameworkFilter
Assembly filter logic from: https://raw.githubusercontent.com/Microsoft/dotnet-apiport/master/src/Microsoft.Fx.Portability/Analyzer/DotNetFrameworkFilter.cs
AtomicBoolean
AtomicInt32
NOTE: This was AtomicInteger in the JDK
AtomicInt64
NOTE: This was AtomicLong in the JDK
AtomicObject<T>
AtomicReferenceArray<T>
Mimics Java's AtomicReferenceArray class (partial implementation)
BitArrayExtensions
This class provides supporting methods of java.util.BitSet that are not present in System.Collections.BitArray.
BundleResourceManagerFactory
This implementation of IResourceManagerFactory uses a convention
to retrieve resources. In Java NLS, the convention is to use the same name for the
resource key propeties and for the resource file names. This presents a problem
for .NET because the resource generator already creates an internal class with the
same name as the .resx
file.
To work around this, we use the convention of appending the suffix "Bundle" to
the end of the type the resource key propeties are stored in. For example,
if our constants are stored in a class named ErrorMessages, the type
that will be looked up by this factory will be ErrorMessagesBundle (which is the
name of the .resx
file that should be added to your project).
This implementation can be inherited to use a different convention or can be replaced to get the resources from an external source.
Character
Mimics Java's Character class.
Collections
ConcurrentHashMapWrapper<TKey, TValue>
ConcurrentHashSet<T>
CRC32
CultureContext
Allows switching the current thread to a new culture in a using block that will automatically return the culture to its previous state upon completion.
DictionaryExtensions
EnumerableExtensions
.NET Specific Helper Extensions for IEnumerable
Equatable
A set of utilities uses for easily wrapping .NET collections so they can be used with System.Object.Equals(System.Object) System.Object.GetHashCode(), and System.Object.ToString() behavior similar to that in Java. The equality checking of collections will recursively compare the values of all elements and any nested collections. The same goes for using System.Object.ToString() - the string is based on the values in the collection and any nested collections.
Do note this has a side-effect that any custom System.Object.Equals(System.Object) System.Object.GetHashCode(), and System.Object.ToString() implementations for types that implement System.Collections.Generic.IList<T> (including arrays), System.Collections.Generic.ISet<T>, or System.Collections.Generic.IDictionary<TKey, TValue> will be ignored.
EquatableList<T>
Represents a strongly typed list of objects that can be accessed by index. Provides methods to manipulate lists. Also provides functionality to compare lists against each other through an implementations of System.IEquatable<T>, or to wrap an existing list to use the same comparison logic as this one while not affecting any of its other functionality.
EquatableSet<T>
Represents a strongly typed set of objects. Provides methods to manipulate the set. Also provides functionality to compare sets against each other through an implementations of System.IEquatable<T>, or to wrap an existing set to use the same comparison logic as this one while not affecting any of its other functionality.
ExceptionExtensions
Extensions to the System.Exception class to allow for adding and retrieving suppressed exceptions, like you can do in Java.
ExceptionToClassNameConventionAttribute
Use this attribute to make an exception to the class naming rules (which should not be named like Interfaces).
ExceptionToNetNumericConventionAttribute
Properties, methods, or events marked with this attribute can ignore the numeric naming conventions of "Int16", "Int32", "Int64", and "Single" that are commonly used in .NET method and property names.
ExceptionToNullableEnumConvention
Use this attribute to make an exception to the nullable enum rule. Some of these cannot be avoided.
HashMap<TKey, TValue>
A C# emulation of the Java Hashmap
A System.Collections.Generic.Dictionary`2 is a close equivalent to the Java
Hashmap. One difference java implementation of the class is that
the Hashmap supports both null keys and values, where the C# Dictionary
only supports null values not keys. Also, V Get(TKey)
method in Java returns null if the key doesn't exist, instead of throwing
an exception. This implementation doesn't throw an exception when a key
doesn't exist, it will return null. This class is slower than using a
System.Collections.Generic.Dictionary`2, because of extra checks that have to be
done on each access, to check for null.
NOTE: This class works best with nullable types. default(T) is returned when a key doesn't exist in the collection (this being similar to how Java returns null). Therefore, if the expected behavior of the java code is to execute code based on if the key exists, when the key is an integer type, it will return 0 instead of null.
IdentityComparer
IdentityComparer<T>
IdentityHashMap<TKey, TValue>
IdentityHashSet<T>
IdentityWeakReference<T>
IndexWriterConfigExtensions
Extension methods that can be used to provide similar IndexWriterConfig syntax as Java Lucene. (config.SetCheckIntegrityAtMerge(100).SetMaxBufferedDocs(1000);)
LinkedHashMap<TKey, TValue>
LinkedHashMap is a specialized dictionary that preserves the entry order of elements.
Like a HashMap, there can be a null
key, but it also guarantees that the enumeration
order of the elements are the same as insertion order, regardless of the number of add/remove/update
operations that are performed on it.
ListExtensions
LurchTable<TKey, TValue>
LurchTable stands for "Least Used Recently Concurrent Hash Table" and has definate similarities to both the .NET 4 ConcurrentDictionary as well as Java's LinkedHashMap. This gives you a thread-safe dictionary/hashtable that stores element ordering by insertion, updates, or access. In addition it can be configured to use a 'hard-limit' count of items that will automatically 'pop' the oldest item in the collection.
LurchTable<TKey, TValue>.KeyCollection
Provides the collection of Keys for the LurchTable
LurchTable<TKey, TValue>.ValueCollection
Provides the collection of Values for the LurchTable
LurchTableCorruptionException
Exception class: LurchTableCorruptionException The LurchTable internal datastructure appears to be corrupted.
MathExtensions
Number
A simple class for number conversions.
NumberFormat
PriorityQueue<T>
A PriorityQueue<T> holds elements on a priority heap, which orders the elements according to their natural order or according to the comparator specified at construction time. If the queue uses natural ordering, only elements that are comparable are permitted to be inserted into the queue.
The least element of the specified ordering is stored at the head of the queue and the greatest element is stored at the tail of the queue.
A PriorityQueue<T> is not synchronized.
RectangularArrays
SetExtensions
SignedZeroComparer
LUCENENET specific comparer to handle the special case of comparing negative zero with positive zero.
For IEEE floating-point numbers, there is a distinction of negative and positive zero. Reference: http://stackoverflow.com/a/3139636
SimpleStringInterner
Simple lockless and memory barrier free String intern cache that is guaranteed to return the same String instance as String.intern() does.
StringBuilderCharSequenceWrapper
An adapter for System.Text.StringBuilder that implements ICharSequence
StringBuilderExtensions
StringCharSequenceWrapper
An adapter for System.String that implements ICharSequence
StringExtensions
StringInterner
Subclasses of StringInterner are required to return the same single String object for all equal strings. Depending on the implementation, this may not be the same object returned as String.intern().
This StringInterner base class simply delegates to String.intern().
LUCENENET specific.
StringTokenizer
The StringTokenizer class allows an application to break a string into tokens by performing code point comparison. The StringTokenizer methods do not distinguish among identifiers, numbers, and quoted strings, nor do they recognize and skip comments.
SystemConsole
Mimics System.Console, but allows for swapping the System.IO.TextWriter of Out and Error, or the System.IO.TextReader of In with user-defined implementations.
SystemProperties
Helper for environment variables. This class helps to convert the environment variables to int or bool data types and also silently handles read permission errors.
For instructions how to set environment variables for your OS, see https://www.schrodinger.com/kb/1842.
Note that if you want to load any of these settings for your application from a configuration file, it is recommended your application load them at startup and call SetProperty(String, String) to set them.
Set the environment variable lucene.ignoreSecurityExceptions
to false
to change the read behavior of these methods to throw the underlying exception
instead of returning the default value.
Time
TreeDictionary<K, V>
A sorted generic dictionary based on a red-black tree set.
TreeSet<T>
An implementation of Red-Black trees as an indexed, sorted collection with set semantics, cf. CLRS. C5.TreeBag`1 for a version with bag semantics. C5.TreeDictionary`2 for a sorted dictionary based on this tree implementation. The comparer (sorting order) may be either natural, because the item type is comparable (generic: C5.IComparable`1 or non-generic: System.IComparable) or it can be external and supplied by the user in the constructor.
TODO: describe performance here TODO: discuss persistence and its useful usage modes. Warn about the space leak possible with other usage modes.
WeakDictionary<TKey, TValue>
WritableArrayAttribute
Attribute to define a property or method as a writable array. Per MSDN, members should never return arrays because the array contents can be updated, which makes the behavior confusing. However, Lucene's design sometimes relies on other classes to update arrays - both as array fields and as methods that return arrays. So, in these cases we are making an exception to this rule and marking them with WritableArrayAttribute to signify that this is intentional.
For properties that violate this rule, you should also use the System.Diagnostics.CodeAnalysis.SuppressMessageAttribute:
[WritableArray, SuppressMessage("Microsoft.Performance", "CA1819", Justification = "Lucene's design requires some writable array properties")]
Structs
LurchTable<TKey, TValue>.Enumerator
Provides an enumerator that iterates through the collection.
LurchTable<TKey, TValue>.KeyCollection.Enumerator
Provides an enumerator that iterates through the collection.
LurchTable<TKey, TValue>.ValueCollection.Enumerator
Provides an enumerator that iterates through the collection.
Interfaces
ICallable<V>
ICharSequence
This interface represents an ordered set of characters and defines the methods to probe them.
IChecksum
Contains conversion support elements such as classes, interfaces and static methods.
ICreateOrUpdateValue<TKey, TValue>
An interface to provide conditional or custom creation or update logic to a concurrent dictionary.
ICreateValue<TKey, TValue>
An interface to provide conditional or custom creation logic to a concurrent dictionary.
IRemoveValue<TKey, TValue>
An interface to provide conditional removal of an item from a concurrent dictionary.
IResourceManagerFactory
LUCENENET specific interface used to inject instances of System.Resources.ResourceManager. This extension point can be used to override the default behavior to, for example, retrieve resources from a persistent data store, rather than getting them from resource files.
IUpdateValue<TKey, TValue>
An interface to provide conditional or custom update logic to a concurrent dictionary.
Enums
LurchTableOrder
Defines if and how items added to a LurchTable are linked together, this defines the value returned from Peek/Dequeue as the oldest entry of the specified operation.
Delegates
KeyValuePredicate<TKey, TValue>
Provides a delegate that performs a test on key/value pair
KeyValueUpdate<TKey, TValue>
Provides a delegate that performs an atomic update of a key/value pair
LurchTable<TKey, TValue>.ItemUpdatedMethod
Method signature for the ItemUpdated event