Class StringDataType
- All Implemented Interfaces:
Comparator<String>, DataType<String>
A string type.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintbinarySearch(String key, Object storageObj, int size, int initialGuess) Perform binary search for the key within the storageintCompare two keys.String[]createStorage(int size) Create storage object of array type to hold valuesintCalculates the amount of used memory in bytes.read(ByteBuffer buff) Read an object.voidwrite(WriteBuffer buff, String s) Write an object.Methods inherited from class BasicDataType
cast, equals, hashCode, isMemoryEstimationAllowed, read, writeMethods inherited from class Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Comparator
reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
Field Details
-
INSTANCE
-
EMPTY_STRING_ARR
-
-
Constructor Details
-
StringDataType
public StringDataType()
-
-
Method Details
-
createStorage
-
compare
Description copied from interface:DataTypeCompare two keys.- Specified by:
comparein interfaceComparator<String>- Specified by:
comparein interfaceDataType<String>- Overrides:
comparein classBasicDataType<String>- Parameters:
a- the first keyb- the second key- Returns:
- -1 if the first key is smaller, 1 if larger, and 0 if equal
-
binarySearch
Description copied from interface:DataTypePerform binary search for the key within the storage- Specified by:
binarySearchin interfaceDataType<String>- Overrides:
binarySearchin classBasicDataType<String>- Parameters:
key- to search forstorageObj- to search within (an array of type T)size- number of data items in the storageinitialGuess- for key position- Returns:
- index of the key , if found, - index of the insertion point, if not
-
getMemory
-
read
Description copied from interface:DataTypeRead an object. -
write
Description copied from interface:DataTypeWrite an object.
-