public abstract class DynamicObjectImpl extends java.lang.Object implements DynamicObject, java.lang.Cloneable
DynamicObject.FlagsFunction| Modifier and Type | Field and Description |
|---|---|
static DebugCounter |
reshapeCount |
| Constructor and Description |
|---|
DynamicObjectImpl(Shape shape) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
changeFlags(java.lang.Object id,
DynamicObject.FlagsFunction updateFunction)
Change property flags.
|
boolean |
changeFlags(java.lang.Object id,
int newFlags)
Change property flags.
|
protected abstract boolean |
checkExtensionArrayInvariants(Shape newShape)
Check whether the extension arrays are in accordance with the description in the shape.
|
protected DynamicObject |
clone() |
protected abstract DynamicObject |
cloneWithShape(Shape currentShape) |
void |
copyProperties(DynamicObject fromObject,
Shape ancestor) |
java.lang.String |
debugDump(int level) |
java.lang.String |
debugDump(int level,
int levelStop) |
void |
define(java.lang.Object id,
java.lang.Object value,
int flags)
Define new property or redefine existing property.
|
void |
define(java.lang.Object id,
java.lang.Object value,
int flags,
LocationFactory locationFactory)
Define new property with a static location or change existing property.
|
boolean |
delete(java.lang.Object id)
Delete property.
|
boolean |
equals(java.lang.Object obj) |
java.lang.Object |
get(java.lang.Object id,
java.lang.Object defaultValue)
Get property value.
|
ShapeImpl |
getShape()
Get the object's current shape.
|
java.lang.Object |
getTypeIdentifier() |
protected abstract void |
growObjectStore(Shape oldShape,
Shape newShape) |
protected abstract void |
growPrimitiveStore(Shape oldShape,
Shape newShape) |
int |
hashCode() |
protected abstract void |
initialize(Shape initialShape) |
boolean |
isEmpty()
Returns
true if this object contains no properties. |
protected abstract void |
resizeObjectStore(Shape oldShape,
Shape newShape) |
protected abstract void |
resizePrimitiveStore(Shape oldShape,
Shape newShape) |
boolean |
set(java.lang.Object id,
java.lang.Object value)
Set value of existing property.
|
protected void |
setShape(Shape shape) |
void |
setShapeAndGrow(Shape oldShape,
Shape newShape)
Set shape to an immediate child of the current shape, optionally growing the extension array.
|
void |
setShapeAndResize(Shape newShape) |
void |
setShapeAndResize(Shape oldShape,
Shape newShape)
Set object shape and resize storage if necessary.
|
int |
size()
Returns the number of properties in this object.
|
java.lang.String |
toString() |
boolean |
updateShape()
Ensure object shape is up-to-date.
|
public static final DebugCounter reshapeCount
public DynamicObjectImpl(Shape shape)
public java.lang.Object getTypeIdentifier()
getTypeIdentifier in interface TypedObjectpublic ShapeImpl getShape()
DynamicObjectgetShape in interface DynamicObjectprotected void setShape(Shape shape)
protected abstract void initialize(Shape initialShape)
public final void setShapeAndResize(Shape newShape)
public final void setShapeAndResize(Shape oldShape, Shape newShape)
DynamicObjectsetShapeAndResize in interface DynamicObjectoldShape - the object's current shape (must equal DynamicObject.getShape())newShape - the new shape to be setpublic final void setShapeAndGrow(Shape oldShape, Shape newShape)
setShapeAndGrow in interface DynamicObjectoldShape - the object's current shape (must equal DynamicObject.getShape())newShape - the new shape to be setsetShapeAndResize(Shape, Shape)protected abstract boolean checkExtensionArrayInvariants(Shape newShape)
protected final DynamicObject clone()
clone in class java.lang.Objectprotected abstract DynamicObject cloneWithShape(Shape currentShape)
public final void copyProperties(DynamicObject fromObject, Shape ancestor)
public boolean changeFlags(java.lang.Object id,
int newFlags)
DynamicObjectchangeFlags in interface DynamicObjectid - property identifiernewFlags - flags to be settrue if successful or false if property not foundpublic boolean changeFlags(java.lang.Object id,
DynamicObject.FlagsFunction updateFunction)
DynamicObjectchangeFlags in interface DynamicObjectid - property identifierupdateFunction - function updating old flags to new flagstrue if successful or false if property not foundpublic java.lang.String debugDump(int level)
public java.lang.String debugDump(int level,
int levelStop)
public java.lang.String toString()
toString in class java.lang.Objectpublic boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic java.lang.Object get(java.lang.Object id,
java.lang.Object defaultValue)
DynamicObjectget in interface DynamicObjectid - property identifierdefaultValue - return value if property is not foundpublic boolean set(java.lang.Object id,
java.lang.Object value)
DynamicObjectset in interface DynamicObjectid - property identifiervalue - value to be settrue if successful or false if property not foundpublic void define(java.lang.Object id,
java.lang.Object value,
int flags)
DynamicObjectdefine in interface DynamicObjectid - property identifiervalue - value to be setflags - flags to be setpublic void define(java.lang.Object id,
java.lang.Object value,
int flags,
LocationFactory locationFactory)
DynamicObjectdefine in interface DynamicObjectid - property identifiervalue - value to be setflags - flags to be setlocationFactory - factory function that creates a location for a given shape and valuepublic boolean delete(java.lang.Object id)
DynamicObjectdelete in interface DynamicObjectid - property identifiertrue if successful or false if property not foundpublic int size()
DynamicObjectsize in interface DynamicObjectpublic boolean isEmpty()
DynamicObjecttrue if this object contains no properties.isEmpty in interface DynamicObjectpublic final boolean updateShape()
DynamicObjectupdateShape in interface DynamicObjecttrue if shape has changed