|
|||||||||||
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 ATObject
meta_invoke
in class NATNil
InterpreterException
public ATBoolean meta_respondsTo(ATSymbol selector) throws InterpreterException
meta_respondsTo
in interface ATObject
meta_respondsTo
in class NATNil
InterpreterException
public ATObject meta_doesNotUnderstand(ATSymbol selector) throws InterpreterException
meta_doesNotUnderstand
in interface ATObject
meta_doesNotUnderstand
in class NATNil
InterpreterException
public ATObject meta_select(ATObject receiver, ATSymbol selector) throws InterpreterException
meta_select
in interface ATObject
meta_select
in class NATNil
InterpreterException
public ATObject meta_lookup(ATSymbol selector) throws InterpreterException
meta_lookup
in interface ATObject
meta_lookup
in class NATNil
InterpreterException
public ATNil meta_defineField(ATSymbol name, ATObject value) throws InterpreterException
meta_defineField
in interface ATObject
meta_defineField
in class NATNil
InterpreterException
public ATNil meta_assignVariable(ATSymbol name, ATObject value) throws InterpreterException
meta_assignVariable
in interface ATObject
meta_assignVariable
in class NATNil
InterpreterException
public ATNil meta_assignField(ATObject receiver, ATSymbol name, ATObject value) throws InterpreterException
meta_assignField
in interface ATObject
meta_assignField
in class NATNil
InterpreterException
public ATObject meta_clone() throws InterpreterException
ATObject
meta_clone
in interface ATObject
meta_clone
in class NATNil
InterpreterException
public ATObject meta_newInstance(ATTable initargs) throws InterpreterException
ATObject
meta_newInstance
in interface ATObject
meta_newInstance
in class NATNil
InterpreterException
public ATObject meta_extend(ATClosure code) throws InterpreterException
ATObject
meta_extend
in interface ATObject
meta_extend
in class NATNil
InterpreterException
public ATObject meta_share(ATClosure code) throws InterpreterException
ATObject
obj.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 ATObject
meta_share
in class NATNil
InterpreterException
public ATNil meta_addField(ATField field) throws InterpreterException
ATObject
meta_addField
in interface ATObject
meta_addField
in class NATNil
InterpreterException
public ATNil meta_addMethod(ATMethod method) throws InterpreterException
ATObject
meta_addMethod
in interface ATObject
meta_addMethod
in class NATNil
InterpreterException
public ATField meta_grabField(ATSymbol selector) throws InterpreterException
ATObject
meta_grabField
in interface ATObject
meta_grabField
in class NATNil
InterpreterException
public ATMethod meta_grabMethod(ATSymbol selector) throws InterpreterException
ATObject
meta_grabMethod
in interface ATObject
meta_grabMethod
in class NATNil
InterpreterException
public ATTable meta_listFields() throws InterpreterException
ATObject
meta_listFields
in interface ATObject
meta_listFields
in class NATNil
InterpreterException
public ATTable meta_listMethods() throws InterpreterException
ATObject
meta_listMethods
in interface ATObject
meta_listMethods
in class NATNil
InterpreterException
public NATText meta_print() throws InterpreterException
ATObject
meta_print
in interface ATObject
meta_print
in class NATNil
InterpreterException
public ATObject meta_getDynamicParent() throws InterpreterException
ATObject
meta_getDynamicParent
in interface ATObject
meta_getDynamicParent
in class NATNil
InterpreterException
public ATObject meta_getLexicalParent() throws InterpreterException
ATObject
meta_getLexicalParent
in interface ATObject
meta_getLexicalParent
in class NATNil
InterpreterException
public boolean base_isCallFrame()
base_isCallFrame
in interface ATConversions
base_isCallFrame
in class NATNil
public ATBoolean meta_isCloneOf(ATObject original) throws InterpreterException
ATObject
meta_isCloneOf
in interface ATObject
meta_isCloneOf
in class NATNil
InterpreterException
public ATBoolean meta_isRelatedTo(ATObject object) throws InterpreterException
ATObject
meta_isRelatedTo
in interface ATObject
meta_isRelatedTo
in class NATNil
InterpreterException
protected boolean hasLocalField(ATSymbol selector) throws InterpreterException
InterpreterException
protected 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 |