Show / Hide Table of Contents

Class EntryComparer

IComparer implementation used to compare cache entries.

Inheritance
object
SafeComparer
EntryComparer
Implements
IQueryCacheComparer
IEntryAwareComparer
IComparer
IPortableObject
Inherited Members
SafeComparer.Comparer
SafeComparer.CompareEntries(IQueryCacheEntry, IQueryCacheEntry)
SafeComparer.IsKeyComparer()
SafeComparer.IsKeyComparer(IComparer)
SafeComparer.ToString()
SafeComparer.CompareSafe(IComparer, object, object)
SafeComparer.Instance
SafeComparer.m_comparer
object.Equals(object, object)
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
Namespace: Tangosol.Util.Comparator
Assembly: Coherence.dll
Syntax
public class EntryComparer : SafeComparer, IQueryCacheComparer, IEntryAwareComparer, IComparer, IPortableObject
Remarks

Depending on the comparison style this comparator will compare entries' values, entries' keys or, when the provided comparator is an instance of IQueryCacheComparer, the entries themselves.

Constructors

EntryComparer()

Default constructor.

Declaration
public EntryComparer()

EntryComparer(IComparer)

Construct an EntryComparer to compare entries' values using the provided IComparer object.

Declaration
public EntryComparer(IComparer comparer)
Parameters
Type Name Description
IComparer comparer

The comparer to use; if not specified the "natural" comparison of entries' values is used.

Remarks

The EntryComparer will choose the comparison style based on the specified comparator type: if the comparer is an instance of the KeyExtractor, the ComparisonStyle.Key style will be assumed; otherwise, the ComparisonStyle.Value style is used.

EntryComparer(IComparer, ComparisonStyle)

Construct an EntryComparer to compare entries using the provided IComparer object according to the specified comparison style.

Declaration
public EntryComparer(IComparer comparer, ComparisonStyle style)
Parameters
Type Name Description
IComparer comparer

The comparer to use; if not specified the "natural" comparison is used.

ComparisonStyle style

The comparison style to use; valid values are any of the ComparisonStyle values.

Remarks

If the style is ComparisonStyle.Auto then the comparator type is checked: if the comparer is an instance of the KeyExtractor, ComparisonStyle.Key style will be assumed; otherwise, the ComparisonStyle.Value style is used.

Properties

CompareEntry

Check whether or not this EntryComparer pass entries themselves for comparison to the underlying CompareEntries(IQueryCacheEntry, IQueryCacheEntry) method.

Declaration
public virtual bool CompareEntry { get; }
Property Value
Type Description
bool

true if entries themselves are used for comparison.

CompareKey

Check whether or not this EntryComparer uses entries' keys to pass for comparison to the underlying IComparer.

Declaration
public virtual bool CompareKey { get; }
Property Value
Type Description
bool

true if entries' keys are used for comparison.

CompareValue

Check whether or not this EntryComparer uses entries' values to pass for comparison to the underlying IComparer.

Declaration
public virtual bool CompareValue { get; }
Property Value
Type Description
bool

true if entries' values are used for comparison.

ComparisonStyle

Obtain the comparison style value utilized by this EntryComparer.

Declaration
public virtual ComparisonStyle ComparisonStyle { get; }
Property Value
Type Description
ComparisonStyle

One of the ComparisonStyle values.

Remarks

The returned value should be one of ComparisonStyle values.

IsCompareEntry

Check whether or not this EntryComparer pass entries themselves for comparison to the underlying CompareEntries(IQueryCacheEntry, IQueryCacheEntry) method.

Declaration
[Obsolete("As of Coherence 3.4 this property is replaced with CompareEntry")]
public virtual bool IsCompareEntry { get; }
Property Value
Type Description
bool

true if entries themselves are used for comparison.

IsCompareKey

Check whether or not this EntryComparer uses entries' keys to pass for comparison to the underlying IComparer.

Declaration
[Obsolete("As of Coherence 3.4 this property is replaced with CompareKey")]
public virtual bool IsCompareKey { get; }
Property Value
Type Description
bool

true if entries' keys are used for comparison.

IsCompareValue

Check whether or not this EntryComparer uses entries' values to pass for comparison to the underlying IComparer.

Declaration
[Obsolete("As of Coherence 3.4 this property is replaced with CompareValue")]
public virtual bool IsCompareValue { get; }
Property Value
Type Description
bool

true if entries' values are used for comparison.

Methods

Compare(object, object)

Compares two arguments for order.

Declaration
public override int Compare(object o1, object o2)
Parameters
Type Name Description
object o1

The first object to be compared.

object o2

The second object to be compared.

Returns
Type Description
int

A negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.

Overrides
SafeComparer.Compare(object, object)
Remarks

The arguments must be ICacheEntry objects. Depending on the comparison style, this method will pass either the entries' values, keys or the entries themselves to the underlying IComparer.

Equals(object)

Determine if two comparers are equal.

Declaration
public override bool Equals(object o)
Parameters
Type Name Description
object o

The other comparer.

Returns
Type Description
bool

true if the passed object is equal to this.

Overrides
SafeComparer.Equals(object)

GetHashCode()

Returns a hash code for this instance.

Declaration
public override int GetHashCode()
Returns
Type Description
int

A hash code for this instance.

Overrides
SafeComparer.GetHashCode()

ReadExternal(IPofReader)

Restore the contents of a user type instance by reading its state using the specified IPofReader object.

Declaration
public override void ReadExternal(IPofReader reader)
Parameters
Type Name Description
IPofReader reader

The IPofReader from which to read the object's state.

Overrides
SafeComparer.ReadExternal(IPofReader)
Exceptions
Type Condition
IOException

If an I/O error occurs.

WriteExternal(IPofWriter)

Save the contents of a POF user type instance by writing its state using the specified IPofWriter object.

Declaration
public override void WriteExternal(IPofWriter writer)
Parameters
Type Name Description
IPofWriter writer

The IPofWriter to which to write the object's state.

Overrides
SafeComparer.WriteExternal(IPofWriter)
Exceptions
Type Condition
IOException

If an I/O error occurs.

Implements

IQueryCacheComparer
IEntryAwareComparer
IComparer
IPortableObject
In this article
Back to top Copyright © 2000, 2024, Oracle and/or its affiliates.