Entity
- monitored entity type.Cloneable
public final class Sandbox<Entity extends Cloneable> extends Object implements Cloneable
Constructor | Description |
---|---|
Sandbox() |
Create a new instance of Sandbox with null as its monitored entity.
|
Sandbox(Monitor<Entity> monitor) |
Create new instance of Sandbox and pull its entity from monitor.
|
Sandbox(Entity entity) |
Create new instance of Sandbox with monitored entity.
|
Modifier and Type | Method | Description |
---|---|---|
boolean |
casByReference(Monitor<Entity> monitor) |
Compare monitored entity with the sandbox copy by reference and set it
to monitor if the reference is the same.
|
boolean |
casByValue(Monitor<Entity> monitor) |
Compare monitored entity with the sandbox copy by value and set it
to monitor if the reference is the same.
|
Sandbox<Entity> |
clone() |
Clone Sandbox.
|
boolean |
equals(Object same) |
Check if sandbox entity is equal to other`s sandbox entity.
|
Entity |
get() |
Access monitored entity.
|
int |
hashCode() |
Return hash code of sandbox entity.
|
Entity |
pull(Monitor<Entity> monitor) |
Access monitored entity in the monitor, assign its clone to sandbox and
return the clone of obtained entity.
|
void |
set(Entity entity) |
Assign a new monitored entity to Sandbox.
|
String |
toString() |
Convert sandbox entity to string.
|
public Sandbox()
public Sandbox(Entity entity)
entity
- monitored entity.public Entity get()
Monitor
then the copy of it is returned. The copy can be mutated
without locking the monitor.set(java.lang.Cloneable)
public void set(Entity entity)
entity
- monitored entity.public Entity pull(Monitor<Entity> monitor)
monitor
- the monitor to pull entity from.public boolean casByReference(Monitor<Entity> monitor)
monitor
- the monitor to set the entity to.public boolean casByValue(Monitor<Entity> monitor)
monitor
- the monitor to set the entity to.public String toString()
public boolean equals(Object same)
public int hashCode()
Copyright © 2011–2018. All rights reserved.