public class DoubleKeyChain extends KeyChain
ctime, elements, isSorted, KEY_DOUBLE, KEY_FLOAT, KEY_INT, KEY_LONG, KEY_SEQUENCE, KEY_STRING, KEY_TIME, metadata, mtime, size, ts
Constructor and Description |
---|
DoubleKeyChain(java.lang.String name,
int capacity) |
Modifier and Type | Method and Description |
---|---|
int |
add(double key,
long currentTime,
int[] meta,
java.lang.Object obj)
It adds the key and the object to the chain, and returns total number
of keys in the chain.
|
int |
add(java.lang.Object key,
long currentTime,
int[] meta,
java.lang.Object obj)
It adds the key and the object to the chain, and returns total number
of keys in the chain.
|
int |
compare(java.lang.Object a,
java.lang.Object b)
It compares a and b in the ascending order
|
int |
find(java.lang.Object key)
It looks for the given key in a sorted instance of KeyChain.
|
java.lang.Object |
get(int i)
It returns the object of the key at the given index or null if the
index is out of bound.
|
java.lang.Object |
getKey(int i)
It returns the key in its data type at the given index or null if the
index is out of bound.
|
int[] |
getMetaData(int i)
It returns the metadata of the key at the given index or null if the
index is out of bound.
|
long |
getTimestamp(int i)
It returns the timestamp of the key at the given index or -1 if the
index is out of bound.
|
int |
insert(java.lang.Object key,
long currentTime,
int[] meta,
java.lang.Object obj)
It inserts the key and the object to the sorted chain and keeps the
sorted order.
|
int |
locate(long currentTime,
int bakeTime)
It assumes the key chain has been sorted in ascending order.
|
java.lang.Object |
remove(int i)
It removes the key at the given index from the chain and disables its
metadata and the object so that they will not be available any more.
|
int |
sort()
It sorts the array of keys in ascending order.
|
int |
truncate(int k)
It truncates the chain by deleting the first given number of keys
permanently and returns the number of keys deleted.
|
clear, equals, finalize, getCapacity, getCTime, getKeyType, getMTime, getName, removable, size
public int add(java.lang.Object key, long currentTime, int[] meta, java.lang.Object obj)
public int add(double key, long currentTime, int[] meta, java.lang.Object obj)
public int insert(java.lang.Object key, long currentTime, int[] meta, java.lang.Object obj)
public java.lang.Object remove(int i)
public java.lang.Object get(int i)
public int[] getMetaData(int i)
getMetaData
in class KeyChain
public long getTimestamp(int i)
getTimestamp
in class KeyChain
public java.lang.Object getKey(int i)
public int find(java.lang.Object key)
public int sort()
public int locate(long currentTime, int bakeTime)
public int truncate(int k)