|
Aviatrix3D 2.1.0 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.j3d.aviatrix3d.iutil.GLStateMap
public class GLStateMap
A very hacked up HashMap variant that is built to maintain simple boolean state values so that multiple contexts can individually track whether state has changed and needs to be updated.
When running in a multi-context environment, such as large-format displays, CAVEs etc, each screen will have it's own GL context. Since each is individually processed by the rendering pipeline, it's very possible that objects appearing on one screen are not on another. When this happens and an update is received to a scenegraph object instance, you will get a situation where one context will flush the state change to create a new display list, but the other context(s) will not, because they were never passed to their respective local graphics pipe. This class manages the simple boolean state that is needed to track whether these changes on a per-GL context have been made or not.
This implementation is not thread-safe, so caution must be exercised about how items are added and removed from the instance. However, since we're only dealing with adding and removing new GL contexts, that should happen very, very rarely. Any state change notifications are made in-place.
HashMap
Constructor Summary | |
---|---|
GLStateMap()
Constructs a new, empty state map with a default capacity and load factor, which is 20 and 0.75 respectively. |
|
GLStateMap(int initialCapacity,
float loadFactor)
Constructs a new, empty state map with the specified initial capacity and the specified load factor. |
Method Summary | |
---|---|
void |
clear()
Clears this state map so that it contains no keys. |
boolean |
containsKey(java.lang.Object key)
Tests if the specified object is a key in this state map. |
boolean |
getState(java.lang.Object key)
Returns the state to which the specified key is set. |
boolean |
isEmpty()
Tests if this state map maps no keys to values. |
void |
put(java.lang.Object key,
boolean value)
Maps the specified key to the specified
value in this state map. |
boolean |
remove(java.lang.Object key)
Removes the key (and its corresponding value) from this state map. |
void |
setAll(boolean state)
Set all the items to the given state. |
int |
size()
Returns the number of keys in this state map. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public GLStateMap()
public GLStateMap(int initialCapacity, float loadFactor)
initialCapacity
- the initial capacity of the state map.loadFactor
- the load factor of the state map.
java.lang.IllegalArgumentException
- if the initial capacity is less
than zero, or if the load factor is nonpositive.Method Detail |
---|
public int size()
public boolean isEmpty()
true
if this state map maps no keys to values;
false
otherwise.public boolean containsKey(java.lang.Object key)
key
- possible key.
true
if and only if the specified object is a
key in this state map, as determined by the equals
method; false
otherwise.public boolean getState(java.lang.Object key)
key
- a key in the state map.
public void put(java.lang.Object key, boolean value)
key
to the specified
value
in this state map. The key cannot be
null
.
The value can be retrieved by calling the get
method
with a key that is equal to the original key.
key
- the state map key.value
- the value to associate with the key
java.lang.NullPointerException
- if the key is null
.public boolean remove(java.lang.Object key)
key
- the key that needs to be removed.
null
if the key did not have a mapping.public void setAll(boolean state)
public void clear()
|
Aviatrix3D 2.1.0 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |