lio.util
Class HierPartition
java.lang.Object
lio.util.Partition
lio.util.HierPartition
public class HierPartition
- extends Partition
Constructor Summary |
HierPartition(int size)
Creates a partition with so many subsets as elements |
Method Summary |
void |
cacheInsert(int p1,
int p2,
double value)
Inserts an entry in the cache. |
double |
cacheValue(int index)
Returns the value of the cache entry in position index |
int |
locateCacheEntry(int pP1,
int pP2)
Locates an entry on the cache and returns its position. |
static void |
main(java.lang.String[] args)
|
void |
merge(int p1,
int p2)
Merges two subsets. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
HierPartition
public HierPartition(int size)
- Creates a partition with so many subsets as elements
- Parameters:
size
- of the partition.
merge
public void merge(int p1,
int p2)
- Description copied from class:
Partition
- Merges two subsets.
The new subset is placed in the position p1, whereas the last subset is
moved to the position p2 compact the data structure.
- Overrides:
merge
in class Partition
- Parameters:
p1
- First subset to be merged.p2
- Second subsetto be merged.
cacheInsert
public void cacheInsert(int p1,
int p2,
double value)
- Inserts an entry in the cache.
locateCacheEntry
public int locateCacheEntry(int pP1,
int pP2)
- Locates an entry on the cache and returns its position.
If the entry is not in the cache, it returns -1.
- Parameters:
pP1
- first subset.pP2
- second subset.
- Returns:
- The position on the cache or -1.
cacheValue
public double cacheValue(int index)
- Returns the value of the cache entry in position index
- Parameters:
index
- Position whose value is been looked.
- Returns:
- Value stored in the position.
main
public static void main(java.lang.String[] args)
- Parameters:
args
-