public class CornerMap
extends java.lang.Object
It stores the map between one of the coordinate of the individual to the individual. For example, we have a individual "ind" with 5 dimension (12, 3, 4, 2, 8), we should create a array "corners" with 5 CornerMap. For each of the CornerMap, we should insert the coordinate of the individual as key, and the individual itself as the value, like (12, ind), (3, ind) .... into their corresponding CornerMap.
CornerMap is essentially a mimic of multimap in C++ where keys are in sorted, but in the ArrayList for each key, the order is determined by their insertion order. Here we simplify it with only useful function such as lowerBound and upperBound.
Modifier and Type | Class and Description |
---|---|
class |
CornerMap.Pair
Simple structure store the key and value from this CornerMap.
|
Constructor and Description |
---|
CornerMap() |
Modifier and Type | Method and Description |
---|---|
boolean |
hasLarger(CornerMap.Pair pair)
Test if we have another key value pair after parameter pair
|
boolean |
hasSmaller(CornerMap.Pair pair)
Test if we have another key value pair before parameter pair
|
void |
insert(int coordindate,
Individual ind)
Insert a key and value pair into CornerMap
|
CornerMap.Pair |
lowerBound(int key)
This returns the smallest element whose key is equal to or bigger than
the argument "key".
|
CornerMap.Pair |
smaller(CornerMap.Pair pair)
Get a greatest key value pair from this CornerMap who is the immediate
previous element of pair
|
CornerMap.Pair |
upperBound(int key)
This method returns the smallest element whose key is bigger than
(excluding equal to) "key",
|
public void insert(int coordindate, Individual ind)
public CornerMap.Pair lowerBound(int key)
public CornerMap.Pair upperBound(int key)
public boolean hasSmaller(CornerMap.Pair pair)
public boolean hasLarger(CornerMap.Pair pair)
public CornerMap.Pair smaller(CornerMap.Pair pair)