Lucene++ - a full-featured, c++ search engine
API Documentation


Loading...
Searching...
No Matches
Static Public Member Functions | Static Protected Attributes
Lucene::MiscUtils Class Reference

#include <MiscUtils.h>

Static Public Member Functions

static uint64_t getTimeMillis (boost::posix_time::ptime time)
 Return given time in milliseconds.
 
static uint64_t currentTimeMillis ()
 Returns the current time in milliseconds.
 
static int32_t getNextSize (int32_t targetSize)
 This over-allocates proportional to the list size, making room for additional growth. The over-allocation is mild, but is enough to give linear-time amortized behavior over a long sequence of appends(). The growth pattern is: 0, 4, 8, 16, 25, 35, 46, 58, 72, 88, ...
 
static int32_t getShrinkSize (int32_t currentSize, int32_t targetSize)
 Only reallocate if we are "substantially" smaller. This saves us from "running hot" (constantly making a bit bigger then a bit smaller, over and over)
 
static int32_t bytesDifference (uint8_t *bytes1, int32_t len1, uint8_t *bytes2, int32_t len2)
 Compares two byte[] arrays, element by element, and returns the number of elements common to both arrays.
 
template<typename TYPE >
static int32_t hashLucene (TYPE type)
 
template<typename TYPE >
static int32_t hashNumeric (TYPE type)
 
template<typename ITER , typename PRED >
static int32_t hashCode (ITER first, ITER last, PRED pred)
 
static int32_t hashCode (const wchar_t *array, int32_t start, int32_t end)
 Returns hash of chars in range start (inclusive) to end (inclusive)
 
static int32_t hashCode (const uint8_t *array, int32_t start, int32_t end)
 Returns hash of bytes in range start (inclusive) to end (inclusive)
 
static int32_t hashCode (bool value)
 Returns hash code of given boolean.
 
template<typename SOURCE , typename DEST >
static void arrayCopy (SOURCE source, int32_t sourceOffset, DEST dest, int32_t destOffset, int32_t length)
 Copy elements from on buffer to another.
 
template<typename DEST , typename FILL >
static void arrayFill (DEST dest, int32_t destFrom, int32_t destTo, FILL value)
 Fill buffer with given element.
 
static int32_t doubleToIntBits (double value)
 Returns a representation of the specified floating-point value according to the IEEE 754 floating-point "single format" bit layout.
 
static int32_t doubleToRawIntBits (double value)
 Returns a representation of the specified floating-point value according to the IEEE 754 floating-point "single format" bit layout, preserving Not-a-Number (NaN) values.
 
static double intBitsToDouble (int32_t bits)
 Returns the float value corresponding to a given bit representation. The argument is considered to be a representation of a floating-point value according to the IEEE 754 floating-point "single format" bit layout.
 
static int64_t doubleToLongBits (double value)
 Returns a representation of the specified floating-point value according to the IEEE 754 floating-point "double format" bit layout.
 
static int64_t doubleToRawLongBits (double value)
 Returns a representation of the specified floating-point value according to the IEEE 754 floating-point "double format" bit layout, preserving Not-a-Number (NaN) values.
 
static double longBitsToDouble (int64_t bits)
 Returns the double value corresponding to a given bit representation. The argument is considered to be a representation of a floating-point value according to the IEEE 754 floating-point "double format" bit layout.
 
static bool isInfinite (double value)
 Returns true if the specified number is infinitely large in magnitude, false otherwise.
 
static bool isNaN (double value)
 Returns true if this Double value is a Not-a-Number (NaN), false otherwise.
 
template<typename TYPE >
static bool typeOf (const LuceneObjectPtr &object)
 Return whether given Lucene object is of a specified type.
 
static bool equalTypes (const LuceneObjectPtr &first, const LuceneObjectPtr &second)
 Return whether given Lucene objects are of equal type.
 
static int64_t unsignedShift (int64_t num, int64_t shift)
 Perform unsigned right-shift (left bits are zero filled)
 
static int32_t unsignedShift (int32_t num, int32_t shift)
 Perform unsigned right-shift (left bits are zero filled)
 

Static Protected Attributes

static const uint32_t SINGLE_EXPONENT_MASK
 
static const uint32_t SINGLE_MANTISSA_MASK
 
static const uint32_t SINGLE_NAN_BITS
 
static const uint64_t DOUBLE_SIGN_MASK
 
static const uint64_t DOUBLE_EXPONENT_MASK
 
static const uint64_t DOUBLE_MANTISSA_MASK
 
static const uint64_t DOUBLE_NAN_BITS
 

Member Function Documentation

◆ arrayCopy()

template<typename SOURCE , typename DEST >
static void Lucene::MiscUtils::arrayCopy ( SOURCE  source,
int32_t  sourceOffset,
DEST  dest,
int32_t  destOffset,
int32_t  length 
)
inlinestatic

Copy elements from on buffer to another.

Referenced by Lucene::TranslationResult< TYPE >::copyText().

◆ arrayFill()

template<typename DEST , typename FILL >
static void Lucene::MiscUtils::arrayFill ( DEST  dest,
int32_t  destFrom,
int32_t  destTo,
FILL  value 
)
inlinestatic

Fill buffer with given element.

◆ bytesDifference()

static int32_t Lucene::MiscUtils::bytesDifference ( uint8_t *  bytes1,
int32_t  len1,
uint8_t *  bytes2,
int32_t  len2 
)
static

Compares two byte[] arrays, element by element, and returns the number of elements common to both arrays.

Parameters
bytes1The first byte[] to compare
bytes2The second byte[] to compare
Returns
The number of common elements.

◆ currentTimeMillis()

static uint64_t Lucene::MiscUtils::currentTimeMillis ( )
static

Returns the current time in milliseconds.

◆ doubleToIntBits()

static int32_t Lucene::MiscUtils::doubleToIntBits ( double  value)
static

Returns a representation of the specified floating-point value according to the IEEE 754 floating-point "single format" bit layout.

◆ doubleToLongBits()

static int64_t Lucene::MiscUtils::doubleToLongBits ( double  value)
static

Returns a representation of the specified floating-point value according to the IEEE 754 floating-point "double format" bit layout.

◆ doubleToRawIntBits()

static int32_t Lucene::MiscUtils::doubleToRawIntBits ( double  value)
static

Returns a representation of the specified floating-point value according to the IEEE 754 floating-point "single format" bit layout, preserving Not-a-Number (NaN) values.

◆ doubleToRawLongBits()

static int64_t Lucene::MiscUtils::doubleToRawLongBits ( double  value)
static

Returns a representation of the specified floating-point value according to the IEEE 754 floating-point "double format" bit layout, preserving Not-a-Number (NaN) values.

◆ equalTypes()

static bool Lucene::MiscUtils::equalTypes ( const LuceneObjectPtr first,
const LuceneObjectPtr second 
)
static

Return whether given Lucene objects are of equal type.

◆ getNextSize()

static int32_t Lucene::MiscUtils::getNextSize ( int32_t  targetSize)
static

This over-allocates proportional to the list size, making room for additional growth. The over-allocation is mild, but is enough to give linear-time amortized behavior over a long sequence of appends(). The growth pattern is: 0, 4, 8, 16, 25, 35, 46, 58, 72, 88, ...

◆ getShrinkSize()

static int32_t Lucene::MiscUtils::getShrinkSize ( int32_t  currentSize,
int32_t  targetSize 
)
static

Only reallocate if we are "substantially" smaller. This saves us from "running hot" (constantly making a bit bigger then a bit smaller, over and over)

◆ getTimeMillis()

static uint64_t Lucene::MiscUtils::getTimeMillis ( boost::posix_time::ptime  time)
static

Return given time in milliseconds.

◆ hashCode() [1/4]

static int32_t Lucene::MiscUtils::hashCode ( bool  value)
static

Returns hash code of given boolean.

◆ hashCode() [2/4]

static int32_t Lucene::MiscUtils::hashCode ( const uint8_t *  array,
int32_t  start,
int32_t  end 
)
static

Returns hash of bytes in range start (inclusive) to end (inclusive)

◆ hashCode() [3/4]

static int32_t Lucene::MiscUtils::hashCode ( const wchar_t *  array,
int32_t  start,
int32_t  end 
)
static

Returns hash of chars in range start (inclusive) to end (inclusive)

◆ hashCode() [4/4]

template<typename ITER , typename PRED >
static int32_t Lucene::MiscUtils::hashCode ( ITER  first,
ITER  last,
PRED  pred 
)
inlinestatic

◆ hashLucene()

template<typename TYPE >
static int32_t Lucene::MiscUtils::hashLucene ( TYPE  type)
inlinestatic

◆ hashNumeric()

template<typename TYPE >
static int32_t Lucene::MiscUtils::hashNumeric ( TYPE  type)
inlinestatic

◆ intBitsToDouble()

static double Lucene::MiscUtils::intBitsToDouble ( int32_t  bits)
static

Returns the float value corresponding to a given bit representation. The argument is considered to be a representation of a floating-point value according to the IEEE 754 floating-point "single format" bit layout.

◆ isInfinite()

static bool Lucene::MiscUtils::isInfinite ( double  value)
static

Returns true if the specified number is infinitely large in magnitude, false otherwise.

◆ isNaN()

static bool Lucene::MiscUtils::isNaN ( double  value)
static

Returns true if this Double value is a Not-a-Number (NaN), false otherwise.

◆ longBitsToDouble()

static double Lucene::MiscUtils::longBitsToDouble ( int64_t  bits)
static

Returns the double value corresponding to a given bit representation. The argument is considered to be a representation of a floating-point value according to the IEEE 754 floating-point "double format" bit layout.

◆ typeOf()

template<typename TYPE >
static bool Lucene::MiscUtils::typeOf ( const LuceneObjectPtr object)
inlinestatic

Return whether given Lucene object is of a specified type.

◆ unsignedShift() [1/2]

int32_t Lucene::MiscUtils::unsignedShift ( int32_t  num,
int32_t  shift 
)
inlinestatic

Perform unsigned right-shift (left bits are zero filled)

◆ unsignedShift() [2/2]

int64_t Lucene::MiscUtils::unsignedShift ( int64_t  num,
int64_t  shift 
)
inlinestatic

Perform unsigned right-shift (left bits are zero filled)

Referenced by Lucene::PriorityQueue< TYPE >::upHeap().

Field Documentation

◆ DOUBLE_EXPONENT_MASK

const uint64_t Lucene::MiscUtils::DOUBLE_EXPONENT_MASK
staticprotected

◆ DOUBLE_MANTISSA_MASK

const uint64_t Lucene::MiscUtils::DOUBLE_MANTISSA_MASK
staticprotected

◆ DOUBLE_NAN_BITS

const uint64_t Lucene::MiscUtils::DOUBLE_NAN_BITS
staticprotected

◆ DOUBLE_SIGN_MASK

const uint64_t Lucene::MiscUtils::DOUBLE_SIGN_MASK
staticprotected

◆ SINGLE_EXPONENT_MASK

const uint32_t Lucene::MiscUtils::SINGLE_EXPONENT_MASK
staticprotected

◆ SINGLE_MANTISSA_MASK

const uint32_t Lucene::MiscUtils::SINGLE_MANTISSA_MASK
staticprotected

◆ SINGLE_NAN_BITS

const uint32_t Lucene::MiscUtils::SINGLE_NAN_BITS
staticprotected

The documentation for this class was generated from the following file:

clucene.sourceforge.net