Package com.oracle.truffle.object
Class PropertyImpl
- java.lang.Object
-
- com.oracle.truffle.api.object.Property
-
- com.oracle.truffle.object.PropertyImpl
-
public class PropertyImpl extends Property
Property objects represent the mapping between low-level stores and high-level data. The simplest Property could be nothing more than a map of one index to one property's value, but abstracting the interface allows for getter/setter methods, type-checked properties, and other such specialized and language-specific behavior. ECMAScript[8.6.1]
-
-
Constructor Summary
Constructors Modifier Constructor Description PropertyImpl(java.lang.Object name, Location location, int flags)protectedPropertyImpl(java.lang.Object key, Location location, int flags, boolean shadow, boolean relocatable)Generic, usual-case constructor for properties storing at least a name.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Propertyconstruct(java.lang.Object name, Location location, int flags)PropertycopyWithFlags(int newFlags)Create a copy of the property with the given flags.PropertycopyWithRelocatable(boolean newRelocatable)booleanequals(java.lang.Object obj)java.lang.Objectget(DynamicObject store, boolean condition)Gets the value of this property of the object.java.lang.Objectget(DynamicObject store, Shape shape)Gets the value of this property of the object.intgetFlags()Get property flags.java.lang.ObjectgetKey()Get property identifier.LocationgetLocation()Get the property location.inthashCode()booleanisHidden()Is this property hidden from iteration.booleanisSame(Property obj)Returnstrueif this property and some other property have the same key and flags.booleanisShadow()Propertyrelocate(Location newLocation)Change the property's location.voidset(DynamicObject store, java.lang.Object value, Shape shape)Assigns value to this property of the object.voidset(DynamicObject store, java.lang.Object value, Shape oldShape, Shape newShape)Assigns value to this property of the object, changing the object's shape.voidsetGeneric(DynamicObject store, java.lang.Object value, Shape shape)Assigns value to this property of the object.voidsetGeneric(DynamicObject store, java.lang.Object value, Shape oldShape, Shape newShape)Assigns value to this property of the object, changing the object's shape.voidsetInternal(DynamicObject store, java.lang.Object value)LikeProperty.setSafe(com.oracle.truffle.api.object.DynamicObject, java.lang.Object, com.oracle.truffle.api.object.Shape), but ignores the finalness of the property.voidsetSafe(DynamicObject store, java.lang.Object value, Shape shape)LikeProperty.set(DynamicObject, Object, Shape), but throws anIllegalStateExceptioninstead.voidsetSafe(DynamicObject store, java.lang.Object value, Shape oldShape, Shape newShape)Assigns value to this property of the object, changing the object's shape.java.lang.StringtoString()
-
-
-
Constructor Detail
-
PropertyImpl
protected PropertyImpl(java.lang.Object key, Location location, int flags, boolean shadow, boolean relocatable)Generic, usual-case constructor for properties storing at least a name.- Parameters:
key- the name of the property
-
PropertyImpl
public PropertyImpl(java.lang.Object name, Location location, int flags)
-
-
Method Detail
-
getKey
public final java.lang.Object getKey()
Description copied from class:PropertyGet property identifier.
-
getFlags
public int getFlags()
Description copied from class:PropertyGet property flags.
-
relocate
public Property relocate(Location newLocation)
Description copied from class:PropertyChange the property's location.
-
get
public final java.lang.Object get(DynamicObject store, Shape shape)
Description copied from class:PropertyGets the value of this property of the object.- Specified by:
getin classProperty- Parameters:
store- the store that this property resides inshape- the current shape of the object, which must contain this location- See Also:
DynamicObject.get(Object, Object)
-
get
public final java.lang.Object get(DynamicObject store, boolean condition)
Description copied from class:PropertyGets the value of this property of the object.- Specified by:
getin classProperty- Parameters:
store- the store that this property resides incondition- the result of a shape check orfalse- See Also:
DynamicObject.get(Object, Object),Property.get(DynamicObject, Shape)
-
setInternal
public final void setInternal(DynamicObject store, java.lang.Object value)
Description copied from class:PropertyLikeProperty.setSafe(com.oracle.truffle.api.object.DynamicObject, java.lang.Object, com.oracle.truffle.api.object.Shape), but ignores the finalness of the property. For internal use only.- Specified by:
setInternalin classProperty- Parameters:
store- the store that this property resides invalue- the value to assign
-
set
public final void set(DynamicObject store, java.lang.Object value, Shape shape) throws IncompatibleLocationException, FinalLocationException
Description copied from class:PropertyAssigns value to this property of the object. Throws an exception if the value cannot be assigned to the property's current location.- Specified by:
setin classProperty- Parameters:
store- the store that this property resides invalue- the value to assignshape- the current shape of the object ornull- Throws:
IncompatibleLocationException- if the value is incompatible with the property locationFinalLocationException- if the location is final and values differ- See Also:
DynamicObject.set(Object, Object)
-
setSafe
public final void setSafe(DynamicObject store, java.lang.Object value, Shape shape)
Description copied from class:PropertyLikeProperty.set(DynamicObject, Object, Shape), but throws anIllegalStateExceptioninstead.
-
setGeneric
public final void setGeneric(DynamicObject store, java.lang.Object value, Shape shape)
Description copied from class:PropertyAssigns value to this property of the object. Automatically relocates the property if the value cannot be assigned to its current location.- Specified by:
setGenericin classPropertyshape- the current shape of the object ornull
-
set
public final void set(DynamicObject store, java.lang.Object value, Shape oldShape, Shape newShape) throws IncompatibleLocationException
Description copied from class:PropertyAssigns value to this property of the object, changing the object's shape. CombinesDynamicObject.setShapeAndGrow(Shape, Shape)andProperty.set(DynamicObject, Object, Shape)to an atomic operation.- Specified by:
setin classProperty- Parameters:
store- the store that this property resides invalue- the value to assignoldShape- the shape before the transitionnewShape- the shape after the transition- Throws:
IncompatibleLocationException- if the value is incompatible with the property location
-
setSafe
public final void setSafe(DynamicObject store, java.lang.Object value, Shape oldShape, Shape newShape)
Description copied from class:PropertyAssigns value to this property of the object, changing the object's shape. CombinesDynamicObject.setShapeAndGrow(Shape, Shape)andProperty.setSafe(DynamicObject, Object, Shape)to an atomic operation.
-
setGeneric
public final void setGeneric(DynamicObject store, java.lang.Object value, Shape oldShape, Shape newShape)
Description copied from class:PropertyAssigns value to this property of the object, changing the object's shape. CombinesDynamicObject.setShapeAndGrow(Shape, Shape)andProperty.setGeneric(DynamicObject, Object, Shape)to an atomic operation.- Specified by:
setGenericin classProperty- Parameters:
store- the store that this property resides invalue- the value to assignoldShape- the shape before the transitionnewShape- the shape after the transition
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
isSame
public boolean isSame(Property obj)
Description copied from class:PropertyReturnstrueif this property and some other property have the same key and flags.
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
getLocation
public final Location getLocation()
Description copied from class:PropertyGet the property location.- Specified by:
getLocationin classProperty
-
isHidden
public final boolean isHidden()
Description copied from class:PropertyIs this property hidden from iteration.
-
copyWithFlags
public Property copyWithFlags(int newFlags)
Description copied from class:PropertyCreate a copy of the property with the given flags.- Specified by:
copyWithFlagsin classProperty
-
copyWithRelocatable
public Property copyWithRelocatable(boolean newRelocatable)
- Specified by:
copyWithRelocatablein classProperty
-
-