public class RegionMap<V> extends Object implements Iterable<RegionMap.Entry<V>>, Serializable
Modifier and Type | Class and Description |
---|---|
static class |
RegionMap.Entries<V> |
static class |
RegionMap.Entry<V> |
static class |
RegionMap.Keys |
static class |
RegionMap.Values<V> |
Modifier and Type | Field and Description |
---|---|
int |
size |
Constructor and Description |
---|
RegionMap()
Creates a new map with an initial capacity of 51 and a load factor of 0.8.
|
RegionMap(int initialCapacity)
Creates a new map with a load factor of 0.8.
|
RegionMap(int initialCapacity,
float loadFactor)
Creates a new map with the specified initial capacity and load factor.
|
RegionMap(RegionMap<? extends V> map)
Creates a new map identical to the specified map.
|
Modifier and Type | Method and Description |
---|---|
LinkedHashSet<V> |
allAt(int x,
int y)
Gets a List of all values associated with regions containing a given x,y point.
|
void |
clear() |
void |
clear(int maximumCapacity)
Clears the map and reduces the size of the backing arrays to be the specified capacity if they are larger.
|
boolean |
containsKey(short[] key) |
boolean |
containsRegion(short[] region)
Checks if a region, stored as packed data (possibly from CoordPacker or this class) overlaps with regions stored
in this object as keys.
|
boolean |
containsValue(Object value,
boolean identity)
Returns true if the specified value is in the map.
|
void |
ensureCapacity(int additionalCapacity)
Increases the size of the backing array to accommodate the specified number of additional items.
|
RegionMap.Entries<V> |
entries()
Returns an iterator for the entries in the map.
|
boolean |
equals(Object obj) |
short[] |
findKey(Object value,
boolean identity)
Returns the key for the specified value, or null if it is not in the map.
|
V |
get(short[] key) |
V |
get(short[] key,
V defaultValue)
Returns the value for the specified key, or the default value if the key is not in the map.
|
int |
hashCode() |
RegionMap.Entries<V> |
iterator() |
RegionMap.Keys |
keys()
Returns an iterator for the keys in the map.
|
V |
put(short[] key,
V value)
Returns the old value associated with the specified key, or null.
|
void |
putAll(RegionMap<V> map) |
LinkedHashSet<short[]> |
regionsContaining(int x,
int y)
Gets a List of all regions containing a given x,y point.
|
V |
remove(short[] key) |
void |
shrink(int maximumCapacity)
Reduces the size of the backing arrays to be the specified capacity or less.
|
String |
toString() |
String |
toString(String separator) |
RegionMap.Values<V> |
values()
Returns an iterator for the values in the map.
|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
forEach, spliterator
public int size
public RegionMap()
public RegionMap(int initialCapacity)
initialCapacity
- If not a power of two, it is increased to the next nearest power of two.public RegionMap(int initialCapacity, float loadFactor)
initialCapacity
- If not a power of two, it is increased to the next nearest power of two.public V put(short[] key, V value)
public V get(short[] key, V defaultValue)
public LinkedHashSet<V> allAt(int x, int y)
x
- the x coordinate of the point in questiony
- the y coordinate of the point in questionpublic boolean containsRegion(short[] region)
region
- the packed region to check for overlap with regions this stores values forpublic LinkedHashSet<short[]> regionsContaining(int x, int y)
x
- the x coordinate of the point in questiony
- the y coordinate of the point in questionpublic void shrink(int maximumCapacity)
public void clear(int maximumCapacity)
public void clear()
public boolean containsValue(Object value, boolean identity)
identity
- If true, uses == to compare the specified value with values in the map. If false, uses
equals(Object)
.public boolean containsKey(short[] key)
public short[] findKey(Object value, boolean identity)
identity
- If true, uses == to compare the specified value with values in the map. If false, uses
equals(Object)
.public void ensureCapacity(int additionalCapacity)
public RegionMap.Entries<V> iterator()
iterator
in interface Iterable<RegionMap.Entry<V>>
public RegionMap.Entries<V> entries()
RegionMap.Entries
constructor for nested or multithreaded iteration.public RegionMap.Values<V> values()
RegionMap.Values
constructor for nested or multithreaded iteration.public RegionMap.Keys keys()
RegionMap.Keys
constructor for nested or multithreaded iteration.Copyright © 2012–2016. All rights reserved.