CPCache
A map-like type that is used by CPSceneObjectContext for game-wide and scene-wide user-data containers.
The instances of this class are created and managed by the game engine and available via CPSceneObjectContext.getSceneCache and CPSceneObjectContext.getGameCache methods. Scene and game caches can be used to exchange and store user-defined data between frames of the same scene or between scenes of the game. Note that by default these caches are in-memory only and not persistent between game executions. One coule, however, add persistence using one of the lifecycle methods available through CPLifecycle type that is extended by both CPSceneObject and CPScene types.
Note that all mutating operations will be queued up and executed at the end of the current frame processing. Specifically, any changes will be "visible" to other scene objects only on the next frame.
Value parameters
- delayedQ
-
Queue for delayed operations. Used internally by the game engine.
Attributes
- See also
- Source
- CPCache.scala
- Graph
-
- Supertypes
-
class Objecttrait Matchableclass Any
Members list
Value members
Concrete methods
Retrieves the value which is associated with the given key.
Retrieves the value which is associated with the given key.
Value parameters
- key
-
The key.
Attributes
- Throws
-
NoSuchElementException
Thrown if there is no mapping for given
key
. - Source
- CPCache.scala
Removes all mappings from this cache.
Removes all mappings from this cache.
Note that all mutating operations will be queued up and executed at the end of the current frame processing. Specifically, any changes will be "visible" to other scene objects only on the next frame.
Attributes
- Source
- CPCache.scala
Tests whether this cache contains a binding for a key.
Tests whether this cache contains a binding for a key.
Value parameters
- key
-
The key.
Attributes
- Source
- CPCache.scala
Retains only those mappings for which the predicate f
returns true
.
Retains only those mappings for which the predicate f
returns true
.
Note that all mutating operations will be queued up and executed at the end of the current frame processing. Specifically, any changes will be "visible" to other scene objects only on the next frame.
Value parameters
- f
-
The test predicate.
Attributes
- Source
- CPCache.scala
Optionally returns the value associated with a key.
Optionally returns the value associated with a key.
Value parameters
- key
-
Key value.
Attributes
- Returns
-
An option value containing the value associated with
key
in this cache, orNone
if none exists. - Source
- CPCache.scala
Tests whether the cache is empty.
Tests whether the cache is empty.
Attributes
- Returns
-
true
if the cache contains no elements,false
otherwise. - Source
- CPCache.scala
Gets iterator can be used only once.
Applies a transformation function to all values contained in this cache. The transformation function produces new values from existing keys associated values.
Applies a transformation function to all values contained in this cache. The transformation function produces new values from existing keys associated values.
Note that all mutating operations will be queued up and executed at the end of the current frame processing. Specifically, any changes will be "visible" to other scene objects only on the next frame.
Value parameters
- f
-
The transformation to apply
Attributes
- Source
- CPCache.scala
Adds a new key/value pair to this cache. If the map already contains a mapping for the key, it will be overridden by the new value.
Adds a new key/value pair to this cache. If the map already contains a mapping for the key, it will be overridden by the new value.
Note that all mutating operations will be queued up and executed at the end of the current frame processing. Specifically, any changes will be "visible" to other scene objects only on the next frame.
Value parameters
- key
-
The key to update.
- value
-
The new value.
Attributes
- Source
- CPCache.scala
Removes a key from this cache.
Removes a key from this cache.
Note that all mutating operations will be queued up and executed at the end of the current frame processing. Specifically, any changes will be "visible" to other scene objects only on the next frame.
Value parameters
- key
-
The key to be removed.
Attributes
- Source
- CPCache.scala