public abstract class ShapeImpl extends Shape
DynamicObject,
Property,
Locations| Modifier and Type | Class and Description |
|---|---|
static class |
ShapeImpl.BaseAllocator |
Shape.Allocator, Shape.Pred<T>| Modifier and Type | Field and Description |
|---|---|
static Shape.Pred<Property> |
ALL
Match all filter.
|
protected int |
depth |
protected boolean |
hasPrimitiveArray |
protected LayoutImpl |
layout |
protected Assumption |
leafAssumption |
protected int |
objectArrayCapacity |
protected int |
objectArraySize |
protected int |
objectFieldSize |
protected ObjectType |
objectType |
protected ShapeImpl |
parent |
protected int |
primitiveArrayCapacity |
protected int |
primitiveArraySize |
protected int |
primitiveFieldSize |
protected Property[] |
propertyArray |
protected int |
propertyCount |
protected static DebugCounter |
propertyListAllocCount |
protected static DebugCounter |
propertyListShareCount |
protected PropertyMap |
propertyMap |
protected Assumption |
validAssumption |
| Modifier | Constructor and Description |
|---|---|
protected |
ShapeImpl(Layout layout,
ObjectType operations,
java.lang.Object sharedData,
int id) |
protected |
ShapeImpl(Layout layout,
ShapeImpl parent,
ObjectType operations,
java.lang.Object sharedData,
PropertyMap propertyMap,
Transition transition,
Shape.Allocator allocator,
int id) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
addDirectTransition(Transition transition,
ShapeImpl next) |
void |
addIndirectTransition(Transition transition,
ShapeImpl next) |
ShapeImpl |
addProperty(Property property)
Add a new property in the map, yielding a new or cached Shape object.
|
ShapeImpl.BaseAllocator |
allocator()
Obtain an
Shape.Allocator instance for the purpose of allocating locations. |
ShapeImpl |
append(Property oldProperty)
Append the property, relocating it to the next allocated location.
|
ShapeImpl |
applyTransition(Transition transition,
boolean append) |
ShapeImpl |
changeType(ObjectType newOps)
Change the shape's type, yielding a new shape.
|
boolean |
check(DynamicObject subject)
Check whether this shape is identical to the given shape.
|
protected ShapeImpl |
cloneOnto(ShapeImpl newParent)
Create a separate clone of a shape.
|
protected ShapeImpl |
cloneRoot(ShapeImpl from,
java.lang.Object newSharedData) |
ShapeImpl |
copyOverPropertiesInternal(Shape destination)
For copying over properties after exchanging the prototype of an object.
|
DynamicObjectFactory |
createFactory()
Create a
DynamicObjectFactory for creating instances of this shape. |
ShapeImpl |
createSeparateShape(java.lang.Object newSharedData)
Clone off a separate shape with new shared data.
|
protected abstract ShapeImpl |
createShape(Layout layout,
java.lang.Object sharedData,
ShapeImpl parent,
ObjectType operations,
PropertyMap propertyMap,
Transition transition,
Shape.Allocator allocator,
int id) |
static java.util.List<Property> |
diff(Shape oldShape,
Shape newShape)
Find difference between two shapes.
|
static ShapeImpl |
findCommonAncestor(ShapeImpl left,
ShapeImpl right)
Find lowest common ancestor of two related shapes.
|
java.lang.Object |
getData()
Get the shape's custom data.
|
int |
getDepth() |
int |
getId() |
java.util.List<java.lang.Object> |
getKeyList()
Get a list of all property keys in insertion order.
|
java.util.List<java.lang.Object> |
getKeyList(Shape.Pred<Property> filter)
Get a list of all (visible) property names in insertion order.
|
java.lang.Iterable<java.lang.Object> |
getKeys()
Get all property keys in insertion order.
|
Property |
getLastProperty()
Get the last added property.
|
LayoutImpl |
getLayout()
Get the shape's layout.
|
Assumption |
getLeafAssumption()
Get an assumption that the shape is a leaf.
|
java.lang.Object |
getMutex()
Get mutex object shared by related shapes, i.e.
|
int |
getObjectArrayCapacity() |
int |
getObjectArraySize() |
int |
getObjectFieldSize() |
ObjectType |
getObjectType()
Get the shape's operations.
|
ShapeImpl |
getParent() |
int |
getPrimitiveArrayCapacity() |
int |
getPrimitiveArraySize() |
int |
getPrimitiveFieldSize() |
java.lang.Iterable<Property> |
getProperties()
An
Iterable over the shape's properties in insertion order. |
Property |
getProperty(java.lang.Object key)
Get a property entry by string name.
|
int |
getPropertyCount()
Get number of properties in this shape.
|
java.util.List<Property> |
getPropertyList()
Get a list of all properties that this Shape stores.
|
java.util.List<Property> |
getPropertyList(Shape.Pred<Property> filter)
Get a list of all properties that this Shape stores.
|
java.util.List<Property> |
getPropertyListInternal(boolean ascending)
Returns all (also hidden) Property objects in this shape.
|
PropertyMap |
getPropertyMap() |
ShapeImpl |
getRoot()
Get the root shape.
|
ShapeImpl |
getShapeFromProperty(java.lang.Object propertyName)
Get the (parent) shape that holds the given property.
|
ShapeImpl |
getShapeFromProperty(Property prop)
Get the (parent) shape that holds the given property.
|
java.lang.Object |
getSharedData()
Get the shape's shared data.
|
Transition |
getTransitionFromParent() |
java.util.Map<Transition,ShapeImpl> |
getTransitionMapForRead() |
Assumption |
getValidAssumption()
Get an assumption that the shape is valid.
|
boolean |
hasPrimitiveArray() |
boolean |
hasProperty(java.lang.Object name)
Check whether the shape has a property with the given key.
|
boolean |
hasTransitionWithKey(java.lang.Object key)
Query whether the shape has a transition with the given key.
|
void |
invalidateValidAssumption() |
boolean |
isLeaf()
Check whether this shape is a leaf in the transition graph, i.e.
|
boolean |
isRelated(Shape other)
Are these two shapes related, i.e.
|
boolean |
isValid()
Check whether this shape is valid.
|
DynamicObject |
newInstance()
Create a new
DynamicObject instance with this shape. |
ShapeImpl |
removeProperty(Property prop)
Remove the given property from the shape.
|
ShapeImpl |
replaceProperty(Property oldProperty,
Property newProperty)
Duplicate shape exchanging existing property with new property.
|
ShapeImpl |
reservePrimitiveExtensionArray()
Reserve the primitive extension array field.
|
java.lang.String |
toString() |
java.lang.String |
toStringLimit(int limit) |
Shape |
tryMerge(Shape other) |
protected final LayoutImpl layout
protected final ObjectType objectType
protected final ShapeImpl parent
protected final PropertyMap propertyMap
protected final int objectArraySize
protected final int objectArrayCapacity
protected final int objectFieldSize
protected final int primitiveFieldSize
protected final int primitiveArraySize
protected final int primitiveArrayCapacity
protected final boolean hasPrimitiveArray
protected final int depth
protected final int propertyCount
protected Property[] propertyArray
protected final Assumption validAssumption
protected volatile Assumption leafAssumption
public static final Shape.Pred<Property> ALL
protected static final DebugCounter propertyListAllocCount
protected static final DebugCounter propertyListShareCount
protected ShapeImpl(Layout layout, ShapeImpl parent, ObjectType operations, java.lang.Object sharedData, PropertyMap propertyMap, Transition transition, Shape.Allocator allocator, int id)
protected ShapeImpl(Layout layout, ObjectType operations, java.lang.Object sharedData, int id)
protected abstract ShapeImpl createShape(Layout layout, java.lang.Object sharedData, ShapeImpl parent, ObjectType operations, PropertyMap propertyMap, Transition transition, Shape.Allocator allocator, int id)
public final Property getLastProperty()
ShapegetLastProperty in class Shapepublic final int getObjectArraySize()
getObjectArraySize in class Shapepublic final int getObjectFieldSize()
getObjectFieldSize in class Shapepublic final int getPrimitiveFieldSize()
getPrimitiveFieldSize in class Shapepublic final int getObjectArrayCapacity()
getObjectArrayCapacity in class Shapepublic final int getPrimitiveArrayCapacity()
getPrimitiveArrayCapacity in class Shapepublic final int getPrimitiveArraySize()
getPrimitiveArraySize in class Shapepublic final boolean hasPrimitiveArray()
hasPrimitiveArray in class Shapepublic final ShapeImpl getShapeFromProperty(java.lang.Object propertyName)
public final ShapeImpl getShapeFromProperty(Property prop)
public final Property getProperty(java.lang.Object key)
getProperty in class Shapekey - the name to look upprotected final void addDirectTransition(Transition transition, ShapeImpl next)
public final void addIndirectTransition(Transition transition, ShapeImpl next)
public final java.util.Map<Transition,ShapeImpl> getTransitionMapForRead()
public final PropertyMap getPropertyMap()
public ShapeImpl addProperty(Property property)
addProperty in class Shapeproperty - the property to addprotected final ShapeImpl cloneOnto(ShapeImpl newParent)
newParent - the cloned parent shapepublic final Transition getTransitionFromParent()
public boolean isRelated(Shape other)
public final java.util.List<Property> getPropertyList(Shape.Pred<Property> filter)
getPropertyList in class Shapepublic final java.util.List<Property> getPropertyList()
ShapegetPropertyList in class Shapepublic final java.util.List<Property> getPropertyListInternal(boolean ascending)
getPropertyListInternal in class Shapeascending - desired orderpublic final java.util.List<java.lang.Object> getKeyList(Shape.Pred<Property> filter)
getKeyList in class Shapepublic final java.util.List<java.lang.Object> getKeyList()
ShapegetKeyList in class Shapepublic java.lang.Iterable<java.lang.Object> getKeys()
Shapepublic final boolean isValid()
Shapepublic final Assumption getValidAssumption()
ShapegetValidAssumption in class Shapepublic final void invalidateValidAssumption()
public final boolean isLeaf()
Shapepublic final Assumption getLeafAssumption()
ShapegetLeafAssumption in class Shapepublic java.lang.String toString()
toString in class java.lang.Objectpublic java.lang.String toStringLimit(int limit)
public final ShapeImpl getParent()
public final int getDepth()
public final boolean hasProperty(java.lang.Object name)
ShapehasProperty in class Shapepublic final ShapeImpl removeProperty(Property prop)
ShaperemoveProperty in class Shapepublic final ShapeImpl append(Property oldProperty)
Shapepublic final ShapeImpl applyTransition(Transition transition, boolean append)
public final ShapeImpl.BaseAllocator allocator()
ShapeShape.Allocator instance for the purpose of allocating locations.public final ShapeImpl replaceProperty(Property oldProperty, Property newProperty)
replaceProperty in class Shapepublic static ShapeImpl findCommonAncestor(ShapeImpl left, ShapeImpl right)
public final ShapeImpl copyOverPropertiesInternal(Shape destination)
copyOverPropertiesInternal in class Shapepublic final int getPropertyCount()
ShapegetPropertyCount in class Shapepublic static java.util.List<Property> diff(Shape oldShape, Shape newShape)
ObjectStorageOptions.TraceReshapepublic ObjectType getObjectType()
ShapegetObjectType in class Shapepublic final boolean check(DynamicObject subject)
Shapepublic final LayoutImpl getLayout()
Shapepublic final java.lang.Object getData()
Shapepublic final java.lang.Object getSharedData()
ShapegetSharedData in class Shapepublic final boolean hasTransitionWithKey(java.lang.Object key)
ShapehasTransitionWithKey in class Shapepublic final ShapeImpl createSeparateShape(java.lang.Object newSharedData)
createSeparateShape in class Shapepublic final ShapeImpl changeType(ObjectType newOps)
ShapechangeType in class Shapepublic final ShapeImpl reservePrimitiveExtensionArray()
ShapereservePrimitiveExtensionArray in class Shapepublic final java.lang.Iterable<Property> getProperties()
ShapeIterable over the shape's properties in insertion order.getProperties in class Shapepublic final DynamicObject newInstance()
ShapeDynamicObject instance with this shape.newInstance in class Shapepublic final DynamicObjectFactory createFactory()
ShapeDynamicObjectFactory for creating instances of this shape.createFactory in class Shapepublic java.lang.Object getMutex()
Shape