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 |
|---|---|
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 int |
propertyCount |
protected PropertyMap |
propertyMap |
protected boolean |
shared |
protected Assumption |
validAssumption |
| Modifier | Constructor and Description |
|---|---|
protected |
ShapeImpl(Layout layout,
ObjectType operations,
Object sharedData,
int id) |
protected |
ShapeImpl(Layout layout,
ShapeImpl parent,
ObjectType operations,
Object sharedData,
PropertyMap propertyMap,
Transition transition,
Shape.Allocator allocator,
int id) |
| Modifier and Type | Method and Description |
|---|---|
<R> R |
accept(ShapeVisitor<R> visitor) |
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 |
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,
Object newSharedData) |
DynamicObjectFactory |
createFactory()
Create a
DynamicObjectFactory for creating instances of this shape. |
ShapeImpl |
createSeparateShape(Object newSharedData)
Clone off a separate shape with new shared data.
|
protected abstract ShapeImpl |
createShape(Layout layout,
Object sharedData,
ShapeImpl parent,
ObjectType operations,
PropertyMap propertyMap,
Transition transition,
Shape.Allocator allocator,
int id) |
ShapeImpl |
defineProperty(Object key,
Object value,
int flags)
Add or change property in the map, yielding a new or cached Shape object.
|
ShapeImpl |
defineProperty(Object key,
Object value,
int flags,
LocationFactory locationFactory)
Add or change property in the map, yielding a new or cached Shape object.
|
static 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.
|
int |
getDepth() |
ForeignAccess |
getForeignAccessFactory(DynamicObject object) |
int |
getId() |
List<Object> |
getKeyList()
Get a list of all property keys in insertion order.
|
List<Object> |
getKeyList(Shape.Pred<Property> filter)
Get a list of all (visible) property names in insertion order.
|
Iterable<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.
|
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() |
Iterable<Property> |
getProperties()
An
Iterable over the shape's properties in insertion order. |
Property |
getProperty(Object key)
Get a property entry by string name.
|
int |
getPropertyCount()
Get number of properties in this shape.
|
List<Property> |
getPropertyList()
Get a list of all properties that this Shape stores.
|
List<Property> |
getPropertyList(Shape.Pred<Property> filter)
Get a list of all properties that this Shape stores.
|
List<Property> |
getPropertyListInternal(boolean ascending)
Returns all (also hidden) Property objects in this shape.
|
PropertyMap |
getPropertyMap() |
ShapeImpl |
getRoot()
Get the root shape.
|
Object |
getSharedData()
Get the shape's shared data.
|
Transition |
getTransitionFromParent() |
Map<Transition,ShapeImpl> |
getTransitionMapForRead() |
Assumption |
getValidAssumption()
Get an assumption that the shape is valid.
|
boolean |
hasPrimitiveArray() |
boolean |
hasProperty(Object name)
Check whether the shape has a property with the given key.
|
boolean |
hasTransitionWithKey(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 |
isShared()
Whether this shape is
shared. |
boolean |
isValid()
Check whether this shape is valid.
|
protected static ShapeImpl |
makeShapeWithAddedProperty(ShapeImpl parent,
Transition.AddPropertyTransition addTransition)
Create a new shape that adds a property to the parent shape.
|
protected static ShapeImpl |
makeShapeWithPrimitiveExtensionArray(ShapeImpl parent,
Transition transition)
Create a new shape that reserves the primitive extension array field.
|
Shape |
makeSharedShape()
Make a shared variant of this shape, to allow safe usage of this object between threads.
|
DynamicObject |
newInstance()
Create a new
DynamicObject instance with this shape. |
protected void |
onPropertyTransition(Property property) |
ShapeImpl |
queryTransition(Transition transition) |
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.
|
String |
toString() |
String |
toStringLimit(int limit) |
Shape |
tryMerge(Shape other)
Try to merge two related shapes to a more general shape that has the same properties and can
store at least the values of both shapes.
|
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 boolean shared
protected final int depth
protected final int propertyCount
protected final Assumption validAssumption
protected volatile Assumption leafAssumption
protected ShapeImpl(Layout layout, ShapeImpl parent, ObjectType operations, Object sharedData, PropertyMap propertyMap, Transition transition, Shape.Allocator allocator, int id)
protected ShapeImpl(Layout layout, ObjectType operations, Object sharedData, int id)
protected abstract ShapeImpl createShape(Layout layout, 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()
public final int getObjectFieldSize()
public final int getPrimitiveFieldSize()
public final int getObjectArrayCapacity()
public final int getPrimitiveArrayCapacity()
public final int getPrimitiveArraySize()
public final boolean hasPrimitiveArray()
public Property getProperty(Object key)
getProperty in class Shapekey - the name to look uppublic final PropertyMap getPropertyMap()
public final void addDirectTransition(Transition transition, ShapeImpl next)
public final void addIndirectTransition(Transition transition, ShapeImpl next)
public final Map<Transition,ShapeImpl> getTransitionMapForRead()
public final ShapeImpl queryTransition(Transition transition)
public ShapeImpl addProperty(Property property)
addProperty in class Shapeproperty - the property to addprotected void onPropertyTransition(Property property)
public ShapeImpl defineProperty(Object key, Object value, int flags)
ShapedefineProperty in class Shapepublic ShapeImpl defineProperty(Object key, Object value, int flags, LocationFactory locationFactory)
ShapedefineProperty in class Shapeprotected ShapeImpl cloneRoot(ShapeImpl from, Object newSharedData)
protected final ShapeImpl cloneOnto(ShapeImpl newParent)
newParent - the cloned parent shapepublic final Transition getTransitionFromParent()
protected static ShapeImpl makeShapeWithAddedProperty(ShapeImpl parent, Transition.AddPropertyTransition addTransition)
protected static ShapeImpl makeShapeWithPrimitiveExtensionArray(ShapeImpl parent, Transition transition)
public boolean isRelated(Shape other)
public final List<Property> getPropertyList(Shape.Pred<Property> filter)
getPropertyList in class Shapepublic final List<Property> getPropertyList()
ShapegetPropertyList in class Shapepublic final List<Property> getPropertyListInternal(boolean ascending)
getPropertyListInternal in class Shapeascending - desired orderpublic final List<Object> getKeyList(Shape.Pred<Property> filter)
getKeyList in class Shapepublic final List<Object> getKeyList()
ShapegetKeyList in class Shapepublic Iterable<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 String toStringLimit(int limit)
public final ShapeImpl getParent()
public final int getDepth()
public final boolean hasProperty(Object name)
ShapehasProperty in class Shapepublic final ShapeImpl removeProperty(Property prop)
ShaperemoveProperty in class Shapepublic final ShapeImpl append(Property oldProperty)
Shapepublic final ShapeImpl.BaseAllocator allocator()
ShapeShape.Allocator instance for the purpose of allocating locations.public ShapeImpl replaceProperty(Property oldProperty, Property newProperty)
replaceProperty in class Shapepublic static ShapeImpl findCommonAncestor(ShapeImpl left, ShapeImpl right)
public final int getPropertyCount()
ShapegetPropertyCount in class Shapepublic static 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 Object getSharedData()
ShapegetSharedData in class Shapepublic final boolean hasTransitionWithKey(Object key)
ShapehasTransitionWithKey in class Shapepublic final ShapeImpl createSeparateShape(Object newSharedData)
createSeparateShape in class Shapepublic final ShapeImpl changeType(ObjectType newOps)
ShapechangeType in class Shapepublic final ShapeImpl reservePrimitiveExtensionArray()
ShapereservePrimitiveExtensionArray in class Shapepublic final 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 Object getMutex()
Shapepublic Shape tryMerge(Shape other)
Shapepublic <R> R accept(ShapeVisitor<R> visitor)
public boolean isShared()
Shapeshared.public Shape makeSharedShape()
ShapemakeSharedShape in class Shapepublic ForeignAccess getForeignAccessFactory(DynamicObject object)