Skip to content

Improved documentation of some object model classes #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jan 20, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,30 @@ public static Layout createLayout() {

public abstract Class<? extends DynamicObject> getType();

public abstract Shape createShape(ObjectType operations);
/**
* Create a root shape.
*
* @param objectType that describes the object instance with this shape.
*/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@woess Can you create something else than a root shape manually? Maybe we should name the method also createRootShape.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We currently don't have any explicit concept of a root shape in names. But yes, you can only create root shapes this way. I'll consider renaming it.

public abstract Shape createShape(ObjectType objectType);

public abstract Shape createShape(ObjectType operations, Object sharedData);
/**
* Create a root shape.
*
* @param objectType that describes the object instance with this shape.
* @param sharedData for language-specific use
*/
public abstract Shape createShape(ObjectType objectType, Object sharedData);

public abstract Shape createShape(ObjectType operations, Object sharedData, int id);
/**
* Create a root shape.
*
* @param objectType that describes the object instance with this shape.
* @param sharedData for language-specific use
* @param id for language-specific use
* @return
*/
public abstract Shape createShape(ObjectType objectType, Object sharedData, int id);

/**
* Create an allocator for static property creation. Reserves all array extension slots.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ public final void set(DynamicObject store, Object value) throws IncompatibleLoca
protected abstract void setInternal(DynamicObject store, Object value) throws IncompatibleLocationException;

/**
* Returns {@code true} if the location can be set to the value.
* Returns {@code true} if the location can be set to the given value.
*
* @param store the receiver object
* @param value the value in question
Expand All @@ -144,9 +144,10 @@ public boolean canSet(Object value) {
}

/**
* Returns {@code true} if the location is compatible with the value.
* Returns {@code true} if the location is compatible with the type of the value.
*
* The value may still be rejected if {@link #canSet(DynamicObject, Object)} returns false.
* The actual value may still be rejected if {@link #canSet(DynamicObject, Object)} returns
* false.
*
* @param value the value in question
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ protected Property() {

/**
* Create a new property.
*
* @param flags, for language-specific use
*/
public static Property create(Object key, Location location, int flags) {
return Layout.getFactory().createProperty(key, location, flags);
Expand All @@ -45,7 +47,7 @@ public static Property create(Object key, Location location, int flags) {
public abstract Object getKey();

/**
* Get property flags.
* Get property flags, which are free for language-specific use.
*/
public abstract int getFlags();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ public DynamicObject newInstance(Shape shape) {
}

@Override
public Shape createShape(ObjectType operations, Object sharedData, int id) {
return new ShapeBasic(this, sharedData, operations, id);
public Shape createShape(ObjectType objectType, Object sharedData, int id) {
return new ShapeBasic(this, sharedData, objectType, id);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
import com.oracle.truffle.object.Transition;

public final class ShapeBasic extends ShapeImpl {
public ShapeBasic(Layout layout, Object sharedData, ObjectType operations, int id) {
super(layout, operations, sharedData, id);
public ShapeBasic(Layout layout, Object sharedData, ObjectType objectType, int id) {
super(layout, objectType, sharedData, id);
}

public ShapeBasic(Layout layout, Object sharedData, ShapeImpl parent, ObjectType objectType, PropertyMap propertyMap, Transition transition, Allocator allocator, int id) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,13 @@ public Class<? extends DynamicObject> getType() {
}

@Override
public final Shape createShape(ObjectType operations, Object sharedData) {
return createShape(operations, sharedData, 0);
public final Shape createShape(ObjectType objectType, Object sharedData) {
return createShape(objectType, sharedData, 0);
}

@Override
public final Shape createShape(ObjectType operations) {
return createShape(operations, null);
public final Shape createShape(ObjectType objectType) {
return createShape(objectType, null);
}

public boolean isAllowedIntToDouble() {
Expand Down