public class EntryComparator extends SafeComparator
QueryMapComparator
, the entries themselves.Base.LoggingWriter, Base.StackFrame
Modifier and Type | Field and Description |
---|---|
static int |
CMP_AUTO
Indicates that this EntryComparator should choose the comparison style
based on the underying comparator type.
|
static int |
CMP_ENTRY
Indicates that entries that implement
QueryMap.Entry interface will be compared
using the compareEntries()
method. |
static int |
CMP_KEY
Indicates that this EntryComparator should compare the entries' keys.
|
static int |
CMP_VALUE
Indicates that this EntryComparator should compare the entries' values.
|
protected int |
m_nStyle
Comparison style utilized by this EntryComparator.
|
INSTANCE, m_comparator, m_fNullFirst
Constructor and Description |
---|
EntryComparator()
Default constructor (for ExternalizableLite and PortableObject).
|
EntryComparator(Comparator comparator)
Construct an EntryComparator to compare entries' values using the
provided Comparator object.
|
EntryComparator(Comparator comparator,
int nStyle)
Construct an EntryComparator to compare entries using the provided
Comparator object according to the specified comparison style.
|
Modifier and Type | Method and Description |
---|---|
int |
compare(Object o1,
Object o2)
Compares two arguments for order.
|
boolean |
equals(Object o)
Determine if two EntryComparator objects are equal.
|
int |
getComparisonStyle()
Obtain the comparison style value utilized by this EntryComparator.
|
boolean |
isCompareEntry()
Check whether or not this EntryComparator pass entries themselves for
comparison to the underlying
compareEntries() method. |
boolean |
isCompareKey()
Check whether or not this EntryComparator uses entries' keys to pass
for comparison to the underlying Comparator.
|
boolean |
isCompareValue()
Check whether or not this EntryComparator uses entries' values to pass
for comparison to the underlying Comparator.
|
void |
readExternal(DataInput in)
Restore the contents of this object by loading the object's state from
the passed DataInput object.
|
void |
readExternal(PofReader in)
Restore the contents of a user type instance by reading its state using
the specified PofReader object.
|
void |
writeExternal(DataOutput out)
Save the contents of this object by storing the object's state into
the passed DataOutput object.
|
void |
writeExternal(PofWriter out)
Save the contents of a POF user type instance by writing its state using
the specified PofWriter object.
|
compareEntries, compareSafe, compareSafe, getComparator, hashCode, INSTANCE, isKeyComparator, isKeyComparator, isNullFirst, toString
azzert, azzert, azzert, azzertFailed, breakLines, breakLines, capitalize, checkNotEmpty, checkNotNull, checkRange, computeSafeWaitTime, decimalValue, dup, dup, ensureBigDecimal, ensureClassLoader, ensureRuntimeException, ensureRuntimeException, equals, equalsDeep, err, err, err, err, err, escape, formatDateTime, getCallerStackFrame, getCommonMonitor, getCommonMonitor, getCommonMonitor, getContextClassLoader, getContextClassLoader, getDeepMessage, getErr, getLastSafeTimeMillis, getLog, getMaxDecDigits, getMaxHexDigits, getOriginalException, getOut, getProcessRandom, getRandom, getRandomBinary, getRandomBinary, getRandomString, getSafeTimeMillis, getStackFrame, getStackFrames, getStackTrace, getStackTrace, getThreadFactory, getTimeZone, getUpTimeMillis, hashCode, hexValue, indentString, indentString, isDecimal, isHex, isLogEcho, isOctal, log, log, log, log, log, makeInteger, makeLong, makeThread, mod, mod, octalValue, out, out, out, out, out, pad, parseBandwidth, parseBandwidth, parseDelimitedString, parseHex, parseHex, parseMemorySize, parseMemorySize, parsePercentage, parseTime, parseTime, parseTimeNanos, parseTimeNanos, printStackTrace, randomize, randomize, randomize, randomize, read, read, read, read, read, read, read, replace, setErr, setLog, setLogEcho, setOut, sleep, toBandwidthString, toBandwidthString, toCharEscape, toCrc, toCrc, toCrc, toCrc, toCrc, toDecString, toDelimitedString, toDelimitedString, toDelimitedString, toDelimitedString, toHex, toHex, toHexDump, toHexEscape, toHexEscape, toHexEscape, toHexEscape, toHexString, toMemorySizeString, toMemorySizeString, toQuotedCharEscape, toQuotedStringEscape, toSqlString, toString, toString, toStringEscape, toUnicodeEscape, trace, trace, trace, trace, trace, trace, trace, trace, trace, truncateString, truncateString, wait
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
comparing, comparing, comparingDouble, comparingInt, comparingLong, naturalOrder, nullsFirst, nullsLast, reversed, reverseOrder, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
comparing, comparing, comparingDouble, comparingInt, comparingLong, nullsFirst, nullsLast, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
public static final int CMP_AUTO
public static final int CMP_VALUE
public static final int CMP_KEY
public static final int CMP_ENTRY
QueryMap.Entry
interface will be compared
using the compareEntries()
method.protected int m_nStyle
public EntryComparator()
public EntryComparator(Comparator comparator)
KeyExtractor
, the CMP_KEY style
will be assumed; otherwise, the CMP_VALUE style is used.comparator
- the comparator to use; if not specified the
"natural" comparison of entries' values is usedpublic EntryComparator(Comparator comparator, int nStyle)
KeyExtractor
, the CMP_KEY style
will be assumed; otherwise, the CMP_VALUE style is used.comparator
- the comparator to use; if not specified the
"natural" comparison is usednStyle
- the comparison style to use; valid values are any
of the CMP_* constantspublic int compare(Object o1, Object o2)
Map.Entry
objects. Depending on the comparison style,
this method will pass either the entries' values, keys or the entries
themselves to the underlying Comparator.compare
in interface Comparator
compare
in class SafeComparator
o1
- the first object to be comparedo2
- the second object to be comparedpublic boolean equals(Object o)
equals
in interface Comparator
equals
in class SafeComparator
o
- the other objectpublic int getComparisonStyle()
public boolean isCompareValue()
public boolean isCompareKey()
public boolean isCompareEntry()
compareEntries()
method.public void readExternal(DataInput in) throws IOException
readExternal
in interface ExternalizableLite
readExternal
in class SafeComparator
in
- the DataInput stream to read data from in order to restore
the state of this objectIOException
- if an I/O exception occursNotActiveException
- if the object is not in its initial
state, and therefore cannot be deserialized intopublic void writeExternal(DataOutput out) throws IOException
writeExternal
in interface ExternalizableLite
writeExternal
in class SafeComparator
out
- the DataOutput stream to write the state of this object toIOException
- if an I/O exception occurspublic void readExternal(PofReader in) throws IOException
readExternal
in interface PortableObject
readExternal
in class SafeComparator
in
- the PofReader from which to read the object's stateIOException
- if an I/O error occurspublic void writeExternal(PofWriter out) throws IOException
writeExternal
in interface PortableObject
writeExternal
in class SafeComparator
out
- the PofWriter to which to write the object's stateIOException
- if an I/O error occurs