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()
Shape
getLastProperty
in class Shape
public final int getObjectArraySize()
getObjectArraySize
in class Shape
public final int getObjectFieldSize()
getObjectFieldSize
in class Shape
public final int getPrimitiveFieldSize()
getPrimitiveFieldSize
in class Shape
public final int getObjectArrayCapacity()
getObjectArrayCapacity
in class Shape
public final int getPrimitiveArrayCapacity()
getPrimitiveArrayCapacity
in class Shape
public final int getPrimitiveArraySize()
getPrimitiveArraySize
in class Shape
public final boolean hasPrimitiveArray()
hasPrimitiveArray
in class Shape
public final ShapeImpl getShapeFromProperty(java.lang.Object propertyName)
public final ShapeImpl getShapeFromProperty(Property prop)
public final Property getProperty(java.lang.Object key)
getProperty
in class Shape
key
- 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 Shape
property
- 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 Shape
public final java.util.List<Property> getPropertyList()
Shape
getPropertyList
in class Shape
public final java.util.List<Property> getPropertyListInternal(boolean ascending)
getPropertyListInternal
in class Shape
ascending
- desired orderpublic final java.util.List<java.lang.Object> getKeyList(Shape.Pred<Property> filter)
getKeyList
in class Shape
public final java.util.List<java.lang.Object> getKeyList()
Shape
getKeyList
in class Shape
public java.lang.Iterable<java.lang.Object> getKeys()
Shape
public final boolean isValid()
Shape
public final Assumption getValidAssumption()
Shape
getValidAssumption
in class Shape
public final void invalidateValidAssumption()
public final boolean isLeaf()
Shape
public final Assumption getLeafAssumption()
Shape
getLeafAssumption
in class Shape
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String toStringLimit(int limit)
public final ShapeImpl getParent()
public final int getDepth()
public final boolean hasProperty(java.lang.Object name)
Shape
hasProperty
in class Shape
public final ShapeImpl removeProperty(Property prop)
Shape
removeProperty
in class Shape
public final ShapeImpl append(Property oldProperty)
Shape
public final ShapeImpl applyTransition(Transition transition, boolean append)
public final ShapeImpl.BaseAllocator allocator()
Shape
Shape.Allocator
instance for the purpose of allocating locations.public final ShapeImpl replaceProperty(Property oldProperty, Property newProperty)
replaceProperty
in class Shape
public static ShapeImpl findCommonAncestor(ShapeImpl left, ShapeImpl right)
public final ShapeImpl copyOverPropertiesInternal(Shape destination)
copyOverPropertiesInternal
in class Shape
public final int getPropertyCount()
Shape
getPropertyCount
in class Shape
public static java.util.List<Property> diff(Shape oldShape, Shape newShape)
ObjectStorageOptions.TraceReshape
public ObjectType getObjectType()
Shape
getObjectType
in class Shape
public final boolean check(DynamicObject subject)
Shape
public final LayoutImpl getLayout()
Shape
public final java.lang.Object getData()
Shape
public final java.lang.Object getSharedData()
Shape
getSharedData
in class Shape
public final boolean hasTransitionWithKey(java.lang.Object key)
Shape
hasTransitionWithKey
in class Shape
public final ShapeImpl createSeparateShape(java.lang.Object newSharedData)
createSeparateShape
in class Shape
public final ShapeImpl changeType(ObjectType newOps)
Shape
changeType
in class Shape
public final ShapeImpl reservePrimitiveExtensionArray()
Shape
reservePrimitiveExtensionArray
in class Shape
public final java.lang.Iterable<Property> getProperties()
Shape
Iterable
over the shape's properties in insertion order.getProperties
in class Shape
public final DynamicObject newInstance()
Shape
DynamicObject
instance with this shape.newInstance
in class Shape
public final DynamicObjectFactory createFactory()
Shape
DynamicObjectFactory
for creating instances of this shape.createFactory
in class Shape
public java.lang.Object getMutex()
Shape