|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.util.AbstractMap<Coord,Integer>
com.threerings.tudey.util.CoordIntMap
public class CoordIntMap
Maps pairs of integer coordinates to integer values.
| Nested Class Summary | |
|---|---|
protected class |
CoordIntMap.Cell
Represents a single top-level cell. |
static class |
CoordIntMap.CoordIntEntry
An entry in the map. |
| Nested classes/interfaces inherited from class java.util.AbstractMap |
|---|
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V> |
| Nested classes/interfaces inherited from interface java.util.Map |
|---|
Map.Entry<K,V> |
| Field Summary | |
|---|---|
protected HashMap<Coord,CoordIntMap.Cell> |
_cells
The top-level cells. |
protected Coord |
_coord
A coord to reuse for queries. |
protected int |
_empty
The value indicating an empty mapping. |
protected int |
_granularity
The size of the top-level cells as a power of two. |
protected int |
_mask
The mask value derived from the granularity. |
protected int |
_modcount
The modification count (used to detect concurrent modifications). |
protected int |
_size
The number of entries in the map. |
| Constructor Summary | |
|---|---|
CoordIntMap()
Creates a new coord int map with a top-level cell size of 8x8 and with the value -1 representing the absence of an entry. |
|
CoordIntMap(int granularity)
Creates a new coord int map with the value -1 representing the absence of an entry. |
|
CoordIntMap(int granularity,
int empty)
Creates a new coord int map. |
|
| Method Summary | |
|---|---|
void |
clear()
|
boolean |
containsKey(int x,
int y)
Determines whether this map contains an entry for the specified coordinates. |
boolean |
containsKey(Object key)
|
boolean |
containsValue(int value)
Determines whether this map contains the specified value. |
boolean |
containsValue(Object value)
|
Set<CoordIntMap.CoordIntEntry> |
coordIntEntrySet()
Returns a set view of the map entries. |
Set<Map.Entry<Coord,Integer>> |
entrySet()
|
int |
get(int x,
int y)
Retrieves the value at the specified coordinates. |
Integer |
get(Object key)
|
protected CoordIntMap.Cell |
getCell(int x,
int y)
Returns the cell corresponding to the specified coordinates. |
protected void |
initTransientFields()
Initializes the transient fields. |
boolean |
isEmpty()
|
Integer |
put(Coord key,
Integer value)
|
int |
put(int x,
int y,
int value)
Sets the value at the specified coordinates. |
void |
readFields(Importer in)
Custom field read method. |
int |
remove(int x,
int y)
Removes the value at the specified coordinates. |
Integer |
remove(Object key)
|
int |
setBits(int x,
int y,
int bits)
Stores the bitwise OR of the previous value and the specified bits at the specified coordinates. |
int |
size()
|
| Methods inherited from class java.util.AbstractMap |
|---|
clone, equals, hashCode, keySet, putAll, toString, values |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected int _granularity
protected int _empty
protected HashMap<Coord,CoordIntMap.Cell> _cells
protected transient int _mask
protected transient int _size
protected transient int _modcount
protected transient Coord _coord
| Constructor Detail |
|---|
public CoordIntMap()
public CoordIntMap(int granularity)
granularity - the size of the top-level cells, expressed as a power of two (e.g.,
3 for cell size 8).
public CoordIntMap(int granularity,
int empty)
granularity - the size of the top-level cells, expressed as a power of two (e.g.,
3 for a cell size of 8 by 8).empty - the value indicating the absence of an entry.| Method Detail |
|---|
public int get(int x,
int y)
public int put(int x,
int y,
int value)
public int setBits(int x,
int y,
int bits)
public int remove(int x,
int y)
public boolean containsKey(int x,
int y)
public boolean containsValue(int value)
public void readFields(Importer in)
throws IOException
IOExceptionpublic Set<CoordIntMap.CoordIntEntry> coordIntEntrySet()
public Set<Map.Entry<Coord,Integer>> entrySet()
entrySet in interface Map<Coord,Integer>entrySet in class AbstractMap<Coord,Integer>public boolean containsKey(Object key)
containsKey in interface Map<Coord,Integer>containsKey in class AbstractMap<Coord,Integer>public boolean containsValue(Object value)
containsValue in interface Map<Coord,Integer>containsValue in class AbstractMap<Coord,Integer>public Integer get(Object key)
get in interface Map<Coord,Integer>get in class AbstractMap<Coord,Integer>
public Integer put(Coord key,
Integer value)
put in interface Map<Coord,Integer>put in class AbstractMap<Coord,Integer>public Integer remove(Object key)
remove in interface Map<Coord,Integer>remove in class AbstractMap<Coord,Integer>public void clear()
clear in interface Map<Coord,Integer>clear in class AbstractMap<Coord,Integer>public int size()
size in interface Map<Coord,Integer>size in class AbstractMap<Coord,Integer>public boolean isEmpty()
isEmpty in interface Map<Coord,Integer>isEmpty in class AbstractMap<Coord,Integer>protected void initTransientFields()
protected CoordIntMap.Cell getCell(int x,
int y)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||