|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectedu.vub.at.objects.natives.NATNil
edu.vub.at.objects.natives.NATByRef
edu.vub.at.objects.natives.NATCallframe
NATCallframe is a native implementation of a callframe. A callframe differs from an ordinary object in the following regards: - it has no dynamic parent - it treats method definition as the addition of a closure to its variables. - it cannot be extended nor cloned Callframes can be regarded as 'field-only' objects. Fields are implemented as follows: - native fields are implemented efficiently using a 'map': the map datastructure maps selectors to indices into a state vector, such that field names can be shared efficiently across clones. - custom fields are collected in a linked list. Their lookup and assignment is slower, and when an object is cloned, the custom field objects are re-instantiated. The new clone is passed as the sole argument to 'new'.
| Field Summary | |
protected java.util.LinkedList |
customFields_
|
protected ATObject |
lexicalParent_
The lexical parent 'scope' of this call frame/object. |
protected java.util.Vector |
stateVector_
|
protected FieldMap |
variableMap_
|
| Fields inherited from class edu.vub.at.objects.natives.NATNil |
_INSTANCE_ |
| Constructor Summary | |
|
NATCallframe(ATObject lexicalParent)
|
protected |
NATCallframe(FieldMap varMap,
java.util.Vector stateVector,
ATObject lexicalParent,
java.util.LinkedList customFields)
Used internally for cloning a callframe/object. |
| Method Summary | |
boolean |
base_isCallFrame()
|
protected ATField |
getLocalCustomField(ATSymbol selector)
|
protected ATObject |
getLocalField(ATSymbol selector)
Reads out the value of either a native or a custom field. |
protected boolean |
hasLocalCustomField(ATSymbol selector)
|
protected boolean |
hasLocalField(ATSymbol selector)
|
protected boolean |
hasLocalNativeField(ATSymbol selector)
|
ATNil |
meta_addField(ATField field)
Adds a field slot to an object at runtime. |
ATNil |
meta_addMethod(ATMethod method)
Adds a method slot to an object at runtime. |
ATNil |
meta_assignField(ATObject receiver,
ATSymbol name,
ATObject value)
Assigning a call frame's field externally is possible and is treated as if it were a variable assignment. |
ATNil |
meta_assignVariable(ATSymbol name,
ATObject value)
A field can be assigned in either a call frame or an object. |
ATObject |
meta_clone()
Clone the receiver object. |
ATNil |
meta_defineField(ATSymbol name,
ATObject value)
A field can be added to either a call frame or an object. |
ATObject |
meta_doesNotUnderstand(ATSymbol selector)
By default, when a selection is not understood by an AmbientTalk object or call frame, an error is raised. |
ATObject |
meta_extend(ATClosure code)
Create an is-a extension of the receiver object. |
ATObject |
meta_getDynamicParent()
Objects have a classical dynamic parent chain created using extension primitives. |
ATObject |
meta_getLexicalParent()
Objects also have a lexical parent which is the scope in which their definitions are nested. |
ATField |
meta_grabField(ATSymbol selector)
Queries an object for one of its field slots. |
ATMethod |
meta_grabMethod(ATSymbol selector)
Queries an object for one of its method slots. |
ATObject |
meta_invoke(ATObject receiver,
ATSymbol selector,
ATTable arguments)
Normally, call frames are not used in receiverful method invocation expressions. |
ATBoolean |
meta_isCloneOf(ATObject original)
Detects whether this object an the passed parameter are the result of cloning from a common ancestor (possibly either one of the objects itself). |
ATBoolean |
meta_isRelatedTo(ATObject object)
Detects whether both objects have a common origin, in other words whether they are related through a combination of the cloning and extension operators. |
ATTable |
meta_listFields()
Queries an object for a list of all of its field slots. |
ATTable |
meta_listMethods()
Queries an object for a list of all of its method slots. |
ATObject |
meta_lookup(ATSymbol selector)
This method is used to evaluate code of the form selector within the scope of this call frame. |
ATObject |
meta_newInstance(ATTable initargs)
Create a new instance of the receiver object. |
NATText |
meta_print()
Prints out the object in a human-readable way. |
ATBoolean |
meta_respondsTo(ATSymbol selector)
respondsTo is a mechanism to ask any object o whether it would respond to the selection o.selector. |
ATObject |
meta_select(ATObject receiver,
ATSymbol selector)
This method is used in the evaluation of the code o.m. |
ATObject |
meta_share(ATClosure code)
Create a shares-a extension of the receiver object. |
protected boolean |
setLocalField(ATSymbol selector,
ATObject value)
Set a given field if it exists. |
| Methods inherited from class edu.vub.at.objects.natives.NATByRef |
meta_pass, meta_resolve |
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface edu.vub.at.objects.ATObject |
base__opeql__opeql_, base_init, base_new, meta_eval, meta_getStripes, meta_isStripedWith, meta_pass, meta_quote, meta_receive, meta_resolve, meta_send |
| Field Detail |
protected FieldMap variableMap_
protected final java.util.Vector stateVector_
protected transient ATObject lexicalParent_
protected java.util.LinkedList customFields_
| Constructor Detail |
public NATCallframe(ATObject lexicalParent)
protected NATCallframe(FieldMap varMap,
java.util.Vector stateVector,
ATObject lexicalParent,
java.util.LinkedList customFields)
| Method Detail |
public ATObject meta_invoke(ATObject receiver,
ATSymbol selector,
ATTable arguments)
throws InterpreterException
meta_invoke in interface ATObjectmeta_invoke in class NATNilInterpreterException
public ATBoolean meta_respondsTo(ATSymbol selector)
throws InterpreterException
meta_respondsTo in interface ATObjectmeta_respondsTo in class NATNilInterpreterException
public ATObject meta_doesNotUnderstand(ATSymbol selector)
throws InterpreterException
meta_doesNotUnderstand in interface ATObjectmeta_doesNotUnderstand in class NATNilInterpreterException
public ATObject meta_select(ATObject receiver,
ATSymbol selector)
throws InterpreterException
meta_select in interface ATObjectmeta_select in class NATNilInterpreterException
public ATObject meta_lookup(ATSymbol selector)
throws InterpreterException
meta_lookup in interface ATObjectmeta_lookup in class NATNilInterpreterException
public ATNil meta_defineField(ATSymbol name,
ATObject value)
throws InterpreterException
meta_defineField in interface ATObjectmeta_defineField in class NATNilInterpreterException
public ATNil meta_assignVariable(ATSymbol name,
ATObject value)
throws InterpreterException
meta_assignVariable in interface ATObjectmeta_assignVariable in class NATNilInterpreterException
public ATNil meta_assignField(ATObject receiver,
ATSymbol name,
ATObject value)
throws InterpreterException
meta_assignField in interface ATObjectmeta_assignField in class NATNilInterpreterException
public ATObject meta_clone()
throws InterpreterException
ATObject
meta_clone in interface ATObjectmeta_clone in class NATNilInterpreterException
public ATObject meta_newInstance(ATTable initargs)
throws InterpreterException
ATObject
meta_newInstance in interface ATObjectmeta_newInstance in class NATNilInterpreterException
public ATObject meta_extend(ATClosure code)
throws InterpreterException
ATObject
meta_extend in interface ATObjectmeta_extend in class NATNilInterpreterException
public ATObject meta_share(ATClosure code)
throws InterpreterException
ATObjectobj.share { code } is represented at the meta-level by
mirror(obj).meta_share(code)
Triggers the objectShared event on this object's beholders (mirror observers).
meta_share in interface ATObjectmeta_share in class NATNilInterpreterException
public ATNil meta_addField(ATField field)
throws InterpreterException
ATObject
meta_addField in interface ATObjectmeta_addField in class NATNilInterpreterException
public ATNil meta_addMethod(ATMethod method)
throws InterpreterException
ATObject
meta_addMethod in interface ATObjectmeta_addMethod in class NATNilInterpreterException
public ATField meta_grabField(ATSymbol selector)
throws InterpreterException
ATObject
meta_grabField in interface ATObjectmeta_grabField in class NATNilInterpreterException
public ATMethod meta_grabMethod(ATSymbol selector)
throws InterpreterException
ATObject
meta_grabMethod in interface ATObjectmeta_grabMethod in class NATNilInterpreterException
public ATTable meta_listFields()
throws InterpreterException
ATObject
meta_listFields in interface ATObjectmeta_listFields in class NATNilInterpreterException
public ATTable meta_listMethods()
throws InterpreterException
ATObject
meta_listMethods in interface ATObjectmeta_listMethods in class NATNilInterpreterException
public NATText meta_print()
throws InterpreterException
ATObject
meta_print in interface ATObjectmeta_print in class NATNilInterpreterException
public ATObject meta_getDynamicParent()
throws InterpreterException
ATObject
meta_getDynamicParent in interface ATObjectmeta_getDynamicParent in class NATNilInterpreterException
public ATObject meta_getLexicalParent()
throws InterpreterException
ATObject
meta_getLexicalParent in interface ATObjectmeta_getLexicalParent in class NATNilInterpreterExceptionpublic boolean base_isCallFrame()
base_isCallFrame in interface ATConversionsbase_isCallFrame in class NATNil
public ATBoolean meta_isCloneOf(ATObject original)
throws InterpreterException
ATObject
meta_isCloneOf in interface ATObjectmeta_isCloneOf in class NATNilInterpreterException
public ATBoolean meta_isRelatedTo(ATObject object)
throws InterpreterException
ATObject
meta_isRelatedTo in interface ATObjectmeta_isRelatedTo in class NATNilInterpreterException
protected boolean hasLocalField(ATSymbol selector)
throws InterpreterException
InterpreterExceptionprotected boolean hasLocalNativeField(ATSymbol selector)
protected boolean hasLocalCustomField(ATSymbol selector)
throws InterpreterException
InterpreterException
protected ATObject getLocalField(ATSymbol selector)
throws InterpreterException
XSelectorNotFound - if no native or custom field with the given name exists locally.
InterpreterException
protected ATField getLocalCustomField(ATSymbol selector)
throws InterpreterException
InterpreterException
protected boolean setLocalField(ATSymbol selector,
ATObject value)
throws InterpreterException
InterpreterException
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||