edu.vub.at.objects.natives
Class NATObject

java.lang.Object
  extended byedu.vub.at.objects.natives.NATNil
      extended byedu.vub.at.objects.natives.NATByRef
          extended byedu.vub.at.objects.natives.NATCallframe
              extended byedu.vub.at.objects.natives.NATObject
All Implemented Interfaces:
ATAbstractGrammar, ATConversions, ATExpression, ATNil, ATObject, ATStatement, java.io.Serializable
Direct Known Subclasses:
JavaClass, JavaObject, JavaPackage, NATActorMirror.NATProtocol, NATActorMirror.NATPublication, NATActorMirror.NATSubscription, NATFarReference.NATDisconnectionSubscription, NATFarReference.NATReconnectionSubscription, NATIntercessiveMirror, NATMessage, NATMirage, NATNamespace

public class NATObject
extends NATCallframe
implements ATObject

Native implementation of a default ambienttalk object. Although a native AmbientTalk object is implemented as a subtype of callframes, the reality is that call frames are a special kind of object. This is a pure form of implementation subclassing: we subclass NATCallframe only for reusing the field definition/assignment protocol and for inheriting the variable map, the state vector and the lexical parent. NATObjects are one of the five native classes that fully implement the ATObject interface (next to NATCallFrame, NATNil, NATMirage and NATSuperObject). The implementation is such that a NATObject instance represents *both* a base-level AmbientTalk object, as well as a meta-level AmbientTalk mirror on that object. An AmbientTalk base-level object has the following structure: - properties: a set of boolean flags denoting: - whether the dynamic parent is an IS_A or a SHARES_A parent - whether the object shares its variable map with clones - whether the object shares its method dictionary with clones - whether the object is an isolate (i.e. pass-by-copy) - a variable map, mapping variable names to indices into the state vector - a state vector, containing the field values of the object - a linked list containing custom field objects - a method dictionary, mapping selectors to methods - a dynamic object parent, to delegate select and invoke operations ( this parent slot is represented by a true AmbientTalk field, rather than by an instance variable ) - a lexical object parent, to support lexical scoping - a table of stripes that were attached to this object (for classification purposes)

Author:
tvcutsem, smostinc
See Also:
Serialized Form

Field Summary
static AGSymbol _EQL_NAME_
           
static AGSymbol _INI_NAME_
           
static boolean _IS_A_
           
private static byte _IS_ISOLATE_FLAG_
          This flag determines whether or not the object is an isolate and hence pass-by-copy: - 1: the object is an isolate, pass-by-copy and no lexical parent except for the root - 0: the object is pass-by-reference and can have any lexical parent
private static byte _ISAPARENT_FLAG_
          This flag determines the type of parent pointer of this object.
static AGSymbol _NEW_NAME_
           
static ATStripe[] _NO_STRIPES_
          An empty stripe array shared by those objects that do not have any stripes.
private static PrimitiveMethod _PRIM_EQL_
          def ==(comparand) { nil }
private static PrimitiveMethod _PRIM_INI_
          def init(@initargs) { nil }
private static PrimitiveMethod _PRIM_NEW_
          def new(@initargs) { nil }
private static byte _SHARE_DCT_FLAG_
          Similar to _SHARE_MAP_FLAG__ but for determining the shared status of the method dictionary.
private static byte _SHARE_MAP_FLAG_
          This flag determines whether or not the field map of this object is shared by other objects: - 1: the map is shared, so modifications must be performed on a copy - 0: the map is not shared, modifications may be directly performed on it This flag is important for maintaining the semantics that clones are self-sufficient objects: they share field names and methods only at the implementation-level.
static boolean _SHARES_A_
           
static AGSymbol _SUPER_NAME_
           
private  byte flags_
          The flags of an AmbientTalk object encode the following boolean information: Format: 0b0000idmp where p = parent flag: if set, dynamic parent is 'is-a' parent, otherwise 'shares-a' parent m = shares map flag: if set, the map of this object is shared between clones d = shares dictionary flag: if set, the method dictionary of this object is shared between clones i = is isolate flag: if set, the object is passed by copy in inter-actor communication
private  MethodDictionary methodDictionary_
          The method dictionary of this object.
protected  ATStripe[] stripes_
          The stripes under which this object has been classified
 
Fields inherited from class edu.vub.at.objects.natives.NATCallframe
customFields_, lexicalParent_, stateVector_, variableMap_
 
Fields inherited from class edu.vub.at.objects.natives.NATNil
_INSTANCE_
 
Constructor Summary
  NATObject()
          Constructs a new AmbientTalk object whose lexical parent is the global scope and whose dynamic parent is the dynamic root.
  NATObject(ATObject lexicalParent)
          Constructs a new ambienttalk object parametrised by a lexical scope.
  NATObject(ATObject dynamicParent, ATObject lexicalParent, boolean parentType)
          Constructs a new ambienttalk object based on a set of parent pointers.
  NATObject(ATObject dynamicParent, ATObject lexicalParent, boolean parentType, ATStripe[] stripes)
          Constructs a new ambienttalk object based on a set of parent pointers.
  NATObject(ATObject lexicalParent, ATStripe[] stripes)
          Constructs a new ambienttalk object parametrised by a lexical scope.
  NATObject(ATObject dynamicParent, boolean parentType)
          Constructs a new ambienttalk object with the given dynamic parent.
  NATObject(ATStripe[] stripes)
           
protected NATObject(FieldMap map, java.util.Vector state, java.util.LinkedList originalCustomFields, MethodDictionary methodDict, ATObject dynamicParent, ATObject lexicalParent, byte flags, ATStripe[] stripes)
          Constructs a new ambienttalk object as a clone of an existing object.
 
Method Summary
 NATObject asAmbientTalkObject()
           
 ATActorMirror base_asActorMirror()
           
 ATAsyncMessage base_asAsyncMessage()
           
 ATBegin base_asBegin()
           
 ATBoolean base_asBoolean()
           
 ATClosure base_asClosure()
           
 ATDefinition base_asDefinition()
           
 ATExpression base_asExpression()
           
 ATField base_asField()
           
 ATHandler base_asHandler()
           
 ATMessage base_asMessage()
           
 ATMessageCreation base_asMessageCreation()
           
 ATMethod base_asMethod()
           
 ATMirror base_asMirror()
           
 ATNumber base_asNumber()
           
 ATSplice base_asSplice()
           
 ATStatement base_asStatement()
           
 ATStripe base_asStripe()
           
 ATSymbol base_asSymbol()
           
 ATTable base_asTable()
           
 ATUnquoteSplice base_asUnquoteSplice()
           
 boolean base_isBoolean()
           
 boolean base_isCallFrame()
           
 boolean base_isClosure()
           
 boolean base_isMethod()
           
 boolean base_isMirror()
           
 boolean base_isSplice()
           
 boolean base_isStripe()
           
 boolean base_isSymbol()
           
 boolean base_isTable()
           
 boolean base_isUnquoteSplice()
           
private  java.lang.Object coerce(ATStripe requiredStripe, java.lang.Class providedInterface)
          ALL asXXX methods return a coercer object which returns a proxy of the correct interface that will 'down' subsequent Java base-level invocations to the AmbientTalk level.
protected  ATObject createChild(ATClosure code, boolean parentPointerType)
          When creating children of objects, care must be taken that an extension of an isolate itself remains an isolate.
protected  NATObject createClone(FieldMap map, java.util.Vector state, java.util.LinkedList originalCustomFields, MethodDictionary methodDict, ATObject dynamicParent, ATObject lexicalParent, byte flags, ATStripe[] stripes)
           
static NATObject createIsolate()
          Creates an object striped with the at.stripes.Isolate stripe.
private  ATMethod getLocalMethod(ATSymbol selector)
           
private  boolean hasLocalMethod(ATSymbol selector)
           
 boolean isAmbientTalkObject()
           
private  boolean isFlagSet(byte flag)
           
private  boolean isLocallyStripedWith(ATStripe stripe)
          Performs a stripe test for this object locally.
static boolean isPrimitive(ATSymbol name)
          Does the selector signify a 'primitive' method, present in each AmbientTalk object?
static ATField[] listTransitiveFields(ATObject obj)
          Auxiliary method to access the fields of an object and all of its super-objects up to (but excluding) nil.
static ATMethod[] listTransitiveMethods(ATObject obj)
          Auxiliary method to access the methods of an object and all of its super-objects up to (but excluding) nil.
 ATNil meta_addMethod(ATMethod method)
          When a method is added to an object, it is first checked whether the method does not already exist.
 ATNil meta_assignField(ATObject receiver, ATSymbol selector, ATObject value)
          meta_assignField is used to evaluate code of the form o.m := v.
 ATObject meta_clone()
          When cloning an object, it is first determined whether the parent has to be shared by the clone, or whether the parent must also be cloned.
 ATNil meta_defineField(ATSymbol name, ATObject value)
          When a new field is defined in an object, it is important to check whether or not the field map is shared between clones or not.
 ATObject meta_extend(ATClosure code)
          Create an is-a extension of the receiver object.
 ATTable meta_getStripes()
          Return the stripes that were directly attached to this object.
 ATMethod meta_grabMethod(ATSymbol selector)
          Queries an object for one of its method slots.
 ATObject meta_invoke(ATObject receiver, ATSymbol selector, ATTable arguments)
          Invocations on an object ( o.m( args ) ) are handled by looking up the requested selector in the dynamic parent chain of the receiver.
 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.
 ATBoolean meta_isStripedWith(ATStripe stripe)
          Check whether one of the stripes of this object is a substripe of the given stripe.
 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 object.
 ATObject meta_newInstance(ATTable initargs)
          When new is invoked on an object's mirror, the object is first cloned by the mirror, after which the method named 'init' is invoked on it.
 ATObject meta_pass()
          An isolate object does not return a proxy representation of itself during serialization, hence it is serialized itself.
 NATText meta_print()
          Prints out the object in a human-readable way.
 ATObject meta_resolve()
          An isolate object represents itself upon deserialization.
 ATBoolean meta_respondsTo(ATSymbol selector)
          An ambienttalk object can respond to a message if a corresponding field or method exists either in the receiver object locally, or in one of its dynamic parents.
 ATObject meta_select(ATObject receiver, ATSymbol selector)
          meta_select is used to evaluate code of the form o.m.
 ATObject meta_share(ATClosure code)
          Create a shares-a extension of the receiver object.
private  void setFlag(byte flag)
           
private  void unsetFlag(byte flag)
           
 
Methods inherited from class edu.vub.at.objects.natives.NATCallframe
getLocalCustomField, getLocalField, hasLocalCustomField, hasLocalField, hasLocalNativeField, meta_addField, meta_assignVariable, meta_doesNotUnderstand, meta_getDynamicParent, meta_getLexicalParent, meta_grabField, meta_listFields, setLocalField
 
Methods inherited from class edu.vub.at.objects.natives.NATNil
asJavaClassUnderSymbiosis, asJavaObjectUnderSymbiosis, asNativeBoolean, asNativeException, asNativeFarReference, asNativeFraction, asNativeNumber, asNativeNumeric, asNativeTable, asNativeText, base__opeql__opeql_, base_asFarReference, base_asVariableAssignment, base_init, base_isFarReference, base_isMessageCreation, base_isVariableAssignment, base_new, equals, isJavaObjectUnderSymbiosis, isNativeBoolean, isNativeField, isNativeText, meta_eval, meta_quote, meta_receive, meta_send, readResolve, toString, writeReplace
 
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_addField, meta_assignVariable, meta_doesNotUnderstand, meta_eval, meta_getDynamicParent, meta_getLexicalParent, meta_grabField, meta_listFields, meta_quote, meta_receive, meta_send
 
Methods inherited from interface edu.vub.at.objects.coercion.ATConversions
asJavaClassUnderSymbiosis, asJavaObjectUnderSymbiosis, asNativeBoolean, asNativeException, asNativeFarReference, asNativeFraction, asNativeNumber, asNativeNumeric, asNativeTable, asNativeText, base_asFarReference, base_asVariableAssignment, base_isFarReference, base_isMessageCreation, base_isVariableAssignment, isJavaObjectUnderSymbiosis, isNativeBoolean, isNativeField, isNativeText
 

Field Detail

_SUPER_NAME_

public static final AGSymbol _SUPER_NAME_

_EQL_NAME_

public static final AGSymbol _EQL_NAME_

_NEW_NAME_

public static final AGSymbol _NEW_NAME_

_INI_NAME_

public static final AGSymbol _INI_NAME_

_PRIM_EQL_

private static final PrimitiveMethod _PRIM_EQL_
def ==(comparand) { nil }


_PRIM_NEW_

private static final PrimitiveMethod _PRIM_NEW_
def new(@initargs) { nil }


_PRIM_INI_

private static final PrimitiveMethod _PRIM_INI_
def init(@initargs) { nil }


_IS_A_

public static final boolean _IS_A_
See Also:
Constant Field Values

_SHARES_A_

public static final boolean _SHARES_A_
See Also:
Constant Field Values

_ISAPARENT_FLAG_

private static final byte _ISAPARENT_FLAG_
This flag determines the type of parent pointer of this object. We distinguish two cases: - 1: an is-a link, which results in a recursive cloning of the parent when this object is cloned. - 0: a shares-a link, which ensures that clones of this object share the same parent.

See Also:
Constant Field Values

_SHARE_MAP_FLAG_

private static final byte _SHARE_MAP_FLAG_
This flag determines whether or not the field map of this object is shared by other objects: - 1: the map is shared, so modifications must be performed on a copy - 0: the map is not shared, modifications may be directly performed on it This flag is important for maintaining the semantics that clones are self-sufficient objects: they share field names and methods only at the implementation-level.

See Also:
Constant Field Values

_SHARE_DCT_FLAG_

private static final byte _SHARE_DCT_FLAG_
Similar to _SHARE_MAP_FLAG__ but for determining the shared status of the method dictionary.

See Also:
Constant Field Values

_IS_ISOLATE_FLAG_

private static final byte _IS_ISOLATE_FLAG_
This flag determines whether or not the object is an isolate and hence pass-by-copy: - 1: the object is an isolate, pass-by-copy and no lexical parent except for the root - 0: the object is pass-by-reference and can have any lexical parent

See Also:
Constant Field Values

_NO_STRIPES_

public static final ATStripe[] _NO_STRIPES_
An empty stripe array shared by those objects that do not have any stripes.


flags_

private byte flags_
The flags of an AmbientTalk object encode the following boolean information: Format: 0b0000idmp where p = parent flag: if set, dynamic parent is 'is-a' parent, otherwise 'shares-a' parent m = shares map flag: if set, the map of this object is shared between clones d = shares dictionary flag: if set, the method dictionary of this object is shared between clones i = is isolate flag: if set, the object is passed by copy in inter-actor communication


methodDictionary_

private MethodDictionary methodDictionary_
The method dictionary of this object. It maps method selectors to ATMethod objects.


stripes_

protected ATStripe[] stripes_
The stripes under which this object has been classified

Constructor Detail

NATObject

public NATObject()
Constructs a new AmbientTalk object whose lexical parent is the global scope and whose dynamic parent is the dynamic root.


NATObject

public NATObject(ATStripe[] stripes)

NATObject

public NATObject(ATObject lexicalParent)
Constructs a new ambienttalk object parametrised by a lexical scope. The object is thus not equipped with a pointer to a dynamic parent.

Parameters:
lexicalParent - - the lexical scope in which the object's definition was nested

NATObject

public NATObject(ATObject lexicalParent,
                 ATStripe[] stripes)
Constructs a new ambienttalk object parametrised by a lexical scope. The object's dynamic parent is nil and is striped with the given table of stripes


NATObject

public NATObject(ATObject dynamicParent,
                 boolean parentType)
Constructs a new ambienttalk object with the given dynamic parent. The lexical parent is assumed to be the global scope.

Parameters:
dynamicParent - - the dynamic parent of the new object
parentType - - the type of parent link

NATObject

public NATObject(ATObject dynamicParent,
                 ATObject lexicalParent,
                 boolean parentType)
Constructs a new ambienttalk object based on a set of parent pointers. The object has no stripes.

Parameters:
dynamicParent - - the parent object of the newly created object
lexicalParent - - the lexical scope in which the object's definition was nested
parentType - - how this object extends its dynamic parent (is-a or shares-a)

NATObject

public NATObject(ATObject dynamicParent,
                 ATObject lexicalParent,
                 boolean parentType,
                 ATStripe[] stripes)
Constructs a new ambienttalk object based on a set of parent pointers. The object is striped with the given stripes.

Parameters:
dynamicParent - - the parent object of the newly created object
lexicalParent - - the lexical scope in which the object's definition was nested
parentType - - how this object extends its dynamic parent (is-a or shares-a)
stripes - - the stripes attached to this object

NATObject

protected NATObject(FieldMap map,
                    java.util.Vector state,
                    java.util.LinkedList originalCustomFields,
                    MethodDictionary methodDict,
                    ATObject dynamicParent,
                    ATObject lexicalParent,
                    byte flags,
                    ATStripe[] stripes)
             throws InterpreterException
Constructs a new ambienttalk object as a clone of an existing object. The caller of this method *must* ensure that the shares flags are set. This constructor is responsible for manually re-initialising any custom field objects, because the init method of such custom fields is parameterized by the clone, which only comes into existence when this constructor runs.

Method Detail

isPrimitive

public static boolean isPrimitive(ATSymbol name)
Does the selector signify a 'primitive' method, present in each AmbientTalk object?


createIsolate

public static NATObject createIsolate()
Creates an object striped with the at.stripes.Isolate stripe. Such an object is called an isolate because: - it has no access to an enclosing lexical scope (except for the root lexical scope) - it can therefore be passed by copy


meta_invoke

public ATObject meta_invoke(ATObject receiver,
                            ATSymbol selector,
                            ATTable arguments)
                     throws InterpreterException
Invocations on an object ( o.m( args ) ) are handled by looking up the requested selector in the dynamic parent chain of the receiver. This dynamic lookup process yields exactly the same result as a selection (e.g. o.m). The result ought to be a closure (a method and its corresponding evaluation context), which is applied to the provided arguments. The code for meta_invoke is actually equivalent to return this.meta_select(receiver, selector).asClosure().meta_apply(arguments); but has a specialized implementation for performance reasons (no unnecessary closure is created)

Specified by:
meta_invoke in interface ATObject
Overrides:
meta_invoke in class NATCallframe
Throws:
InterpreterException

meta_respondsTo

public ATBoolean meta_respondsTo(ATSymbol selector)
                          throws InterpreterException
An ambienttalk object can respond to a message if a corresponding field or method exists either in the receiver object locally, or in one of its dynamic parents.

Specified by:
meta_respondsTo in interface ATObject
Overrides:
meta_respondsTo in class NATCallframe
Throws:
InterpreterException

meta_select

public ATObject meta_select(ATObject receiver,
                            ATSymbol selector)
                     throws InterpreterException
meta_select is used to evaluate code of the form o.m. To select a slot from an object: - first, the list of fields of the current receiver ('this') is searched. If a matching field exists, its value is returned. - second, the list of methods of the current receiver is searched. If a matching method exists, it is returned, but wrapped in a closure. This wrapping is vital to ensure that the method is paired with the correct 'self'. This 'self' does not necessarily equal 'this'. - third, the search for the slot is carried out recursively in the dynamic parent. As such, slot selection traverses the dynamic parent chain up to a dynamic root. The dynamic root deals with an unbound slot by sending the 'doesNotUnderstand' message to the original receiver.

Specified by:
meta_select in interface ATObject
Overrides:
meta_select in class NATCallframe
Parameters:
receiver - the original receiver of the selection
selector - the selector to look up
Returns:
the value of the found field, or a closure wrapping a found method
Throws:
InterpreterException

meta_lookup

public ATObject meta_lookup(ATSymbol selector)
                     throws InterpreterException
This method is used to evaluate code of the form selector within the scope of this object. An object resolves such a lookup request as follows: - If a field corresponding to the selector exists locally, the field's value is returned. - If a method corresponding to the selector exists locally, the method is wrapped using the current object itself as implementor AND as 'self'. The reason for setting the closure's 'self' to the implementor is because a lookup can only be initiated by the object itself or a lexically nested one. Lexical nesting, however, has nothing to do with dynamic delegation, and it would be wrong to bind 'self' to a nested object which need not be a dynamic child of the implementor. - Otherwise, the search continues recursively in the object's lexical parent.

Specified by:
meta_lookup in interface ATObject
Overrides:
meta_lookup in class NATCallframe
Throws:
InterpreterException

meta_defineField

public ATNil meta_defineField(ATSymbol name,
                              ATObject value)
                       throws InterpreterException
When a new field is defined in an object, it is important to check whether or not the field map is shared between clones or not. If it is shared, the map must be cloned first.

Specified by:
meta_defineField in interface ATObject
Overrides:
meta_defineField in class NATCallframe
Throws:
InterpreterException

meta_assignField

public ATNil meta_assignField(ATObject receiver,
                              ATSymbol selector,
                              ATObject value)
                       throws InterpreterException
meta_assignField is used to evaluate code of the form o.m := v. To assign a field in an object: - first, the list of fields of the current receiver ('this') is searched. If a matching field exists, its value is set. - If the field is not found, the search for the slot is carried out recursively in the dynamic parent. As such, field assignment traverses the dynamic parent chain up to a dynamic root. The dynamic root deals with an unbound field by throwing an error.

Specified by:
meta_assignField in interface ATObject
Overrides:
meta_assignField in class NATCallframe
Parameters:
value - the value to assign to the field
selector - the field to assign
Returns:
NIL
Throws:
InterpreterException

meta_clone

public ATObject meta_clone()
                    throws InterpreterException
When cloning an object, it is first determined whether the parent has to be shared by the clone, or whether the parent must also be cloned. This depends on whether the dynamic parent is an 'is-a' parent or a 'shares-a' parent. This is determined by the _ISAPARENT_FLAG_ object flag. A cloned object shares with its original both the variable map (to avoid having to copy space for field names) and the method dictionary (method bindings are constant and can hence be shared). Should either the original or the clone later modify the map or the dictionary (at the meta-level), the map or dictionary will be copied first. Hence, sharing between clones is an implementation-level optimization: clones are completely self-sufficient and do not influence one another by meta-level operations.

Specified by:
meta_clone in interface ATObject
Overrides:
meta_clone in class NATCallframe
Throws:
InterpreterException

meta_newInstance

public ATObject meta_newInstance(ATTable initargs)
                          throws InterpreterException
When new is invoked on an object's mirror, the object is first cloned by the mirror, after which the method named 'init' is invoked on it. meta_newInstance(t) = base_init(t) o meta_clone Care should be taken that a shares-a child implements its own init method which does NOT perform a super-send. If this is not the case, then it is possible that a shared parent is accidentally re-initialized because a sharing child is cloned via new.

Specified by:
meta_newInstance in interface ATObject
Overrides:
meta_newInstance in class NATCallframe
Throws:
InterpreterException

meta_extend

public ATObject meta_extend(ATClosure code)
                     throws InterpreterException
Description copied from interface: ATObject
Create an is-a extension of the receiver object. The base-level code is represented at the meta-level by Triggers the objectExtended event on this object's beholders (mirror observers).

Specified by:
meta_extend in interface ATObject
Overrides:
meta_extend in class NATCallframe
Throws:
InterpreterException

meta_share

public ATObject meta_share(ATClosure code)
                    throws InterpreterException
Description copied from interface: ATObject
Create a shares-a extension of the receiver object. The base-level code 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).

Specified by:
meta_share in interface ATObject
Overrides:
meta_share in class NATCallframe
Throws:
InterpreterException

meta_addMethod

public ATNil meta_addMethod(ATMethod method)
                     throws InterpreterException
When a method is added to an object, it is first checked whether the method does not already exist. Also, care has to be taken that the method dictionary of an object does not affect clones. Therefore, if the method dictionary is shared, a copy of the dictionary is taken before adding the method. One exception to method addition are primitive methods: if the method added would conflict with a primitive method, the primitive is replaced by the new method instead.

Specified by:
meta_addMethod in interface ATObject
Overrides:
meta_addMethod in class NATCallframe
Throws:
InterpreterException

meta_grabMethod

public ATMethod meta_grabMethod(ATSymbol selector)
                         throws InterpreterException
Description copied from interface: ATObject
Queries an object for one of its method slots. Triggers the methodAccessed event on this object's beholders (mirror observers).

Specified by:
meta_grabMethod in interface ATObject
Overrides:
meta_grabMethod in class NATCallframe
Throws:
InterpreterException

meta_listMethods

public ATTable meta_listMethods()
                         throws InterpreterException
Description copied from interface: ATObject
Queries an object for a list of all of its method slots. TODO(beholders) should this method trigger beholders? if so, using a single 'methodsQueried' event or by invoking 'methodAccessed' for each field in the list returned?

Specified by:
meta_listMethods in interface ATObject
Overrides:
meta_listMethods in class NATCallframe
Throws:
InterpreterException

meta_print

public NATText meta_print()
                   throws InterpreterException
Description copied from interface: ATObject
Prints out the object in a human-readable way.

Specified by:
meta_print in interface ATObject
Overrides:
meta_print in class NATCallframe
Throws:
InterpreterException

base_isCallFrame

public boolean base_isCallFrame()
Specified by:
base_isCallFrame in interface ATConversions
Overrides:
base_isCallFrame in class NATCallframe

createClone

protected NATObject createClone(FieldMap map,
                                java.util.Vector state,
                                java.util.LinkedList originalCustomFields,
                                MethodDictionary methodDict,
                                ATObject dynamicParent,
                                ATObject lexicalParent,
                                byte flags,
                                ATStripe[] stripes)
                         throws InterpreterException
Throws:
InterpreterException

createChild

protected ATObject createChild(ATClosure code,
                               boolean parentPointerType)
                        throws InterpreterException
When creating children of objects, care must be taken that an extension of an isolate itself remains an isolate.

Overrides:
createChild in class NATNil
Throws:
InterpreterException

meta_isCloneOf

public ATBoolean meta_isCloneOf(ATObject original)
                         throws InterpreterException
Description copied from interface: ATObject
Detects whether this object an the passed parameter are the result of cloning from a common ancestor (possibly either one of the objects itself).

Specified by:
meta_isCloneOf in interface ATObject
Overrides:
meta_isCloneOf in class NATCallframe
Throws:
InterpreterException

meta_isRelatedTo

public ATBoolean meta_isRelatedTo(ATObject object)
                           throws InterpreterException
Description copied from interface: ATObject
Detects whether both objects have a common origin, in other words whether they are related through a combination of the cloning and extension operators.

Specified by:
meta_isRelatedTo in interface ATObject
Overrides:
meta_isRelatedTo in class NATCallframe
Throws:
InterpreterException

meta_isStripedWith

public ATBoolean meta_isStripedWith(ATStripe stripe)
                             throws InterpreterException
Check whether one of the stripes of this object is a substripe of the given stripe. If not, then delegate the query to the dynamic parent.

Specified by:
meta_isStripedWith in interface ATObject
Overrides:
meta_isStripedWith in class NATNil
Throws:
InterpreterException

meta_getStripes

public ATTable meta_getStripes()
                        throws InterpreterException
Return the stripes that were directly attached to this object.

Specified by:
meta_getStripes in interface ATObject
Overrides:
meta_getStripes in class NATNil
Throws:
InterpreterException

meta_pass

public ATObject meta_pass()
                   throws InterpreterException
An isolate object does not return a proxy representation of itself during serialization, hence it is serialized itself. If the object is not an isolate, invoke the default behaviour for by-reference objects

Specified by:
meta_pass in interface ATObject
Overrides:
meta_pass in class NATByRef
Throws:
InterpreterException

meta_resolve

public ATObject meta_resolve()
                      throws InterpreterException
An isolate object represents itself upon deserialization. If this object is not an isolate, the default behaviour for by-reference objects is invoked.

Specified by:
meta_resolve in interface ATObject
Overrides:
meta_resolve in class NATByRef
Throws:
InterpreterException

asAmbientTalkObject

public NATObject asAmbientTalkObject()
Specified by:
asAmbientTalkObject in interface ATConversions
Overrides:
asAmbientTalkObject in class NATNil

coerce

private java.lang.Object coerce(ATStripe requiredStripe,
                                java.lang.Class providedInterface)
                         throws InterpreterException
ALL asXXX methods return a coercer object which returns a proxy of the correct interface that will 'down' subsequent Java base-level invocations to the AmbientTalk level. Coercion only happens if the object is striped with the correct stripe.

Throws:
InterpreterException

base_asBoolean

public ATBoolean base_asBoolean()
                         throws InterpreterException
Specified by:
base_asBoolean in interface ATConversions
Overrides:
base_asBoolean in class NATNil
Throws:
InterpreterException

base_asClosure

public ATClosure base_asClosure()
                         throws InterpreterException
Specified by:
base_asClosure in interface ATConversions
Overrides:
base_asClosure in class NATNil
Throws:
InterpreterException

base_asExpression

public ATExpression base_asExpression()
                               throws InterpreterException
Specified by:
base_asExpression in interface ATConversions
Overrides:
base_asExpression in class NATNil
Throws:
InterpreterException

base_asField

public ATField base_asField()
                     throws InterpreterException
Specified by:
base_asField in interface ATConversions
Overrides:
base_asField in class NATNil
Throws:
InterpreterException

base_asMessage

public ATMessage base_asMessage()
                         throws InterpreterException
Specified by:
base_asMessage in interface ATConversions
Overrides:
base_asMessage in class NATNil
Throws:
InterpreterException

base_asMethod

public ATMethod base_asMethod()
                       throws InterpreterException
Specified by:
base_asMethod in interface ATConversions
Overrides:
base_asMethod in class NATNil
Throws:
InterpreterException

base_asMirror

public ATMirror base_asMirror()
                       throws InterpreterException
Specified by:
base_asMirror in interface ATConversions
Overrides:
base_asMirror in class NATNil
Throws:
InterpreterException

base_asHandler

public ATHandler base_asHandler()
                         throws InterpreterException
Specified by:
base_asHandler in interface ATConversions
Overrides:
base_asHandler in class NATNil
Throws:
InterpreterException

base_asNumber

public ATNumber base_asNumber()
                       throws InterpreterException
Specified by:
base_asNumber in interface ATConversions
Overrides:
base_asNumber in class NATNil
Throws:
InterpreterException

base_asTable

public ATTable base_asTable()
                     throws InterpreterException
Specified by:
base_asTable in interface ATConversions
Overrides:
base_asTable in class NATNil
Throws:
InterpreterException

base_asAsyncMessage

public ATAsyncMessage base_asAsyncMessage()
                                   throws InterpreterException
Specified by:
base_asAsyncMessage in interface ATConversions
Overrides:
base_asAsyncMessage in class NATNil
Throws:
InterpreterException

base_asActorMirror

public ATActorMirror base_asActorMirror()
                                 throws InterpreterException
Specified by:
base_asActorMirror in interface ATConversions
Overrides:
base_asActorMirror in class NATNil
Throws:
InterpreterException

base_asStripe

public ATStripe base_asStripe()
                       throws InterpreterException
Specified by:
base_asStripe in interface ATConversions
Overrides:
base_asStripe in class NATNil
Throws:
InterpreterException

base_asBegin

public ATBegin base_asBegin()
                     throws InterpreterException
Specified by:
base_asBegin in interface ATConversions
Overrides:
base_asBegin in class NATNil
Throws:
InterpreterException

base_asStatement

public ATStatement base_asStatement()
                             throws InterpreterException
Specified by:
base_asStatement in interface ATConversions
Overrides:
base_asStatement in class NATNil
Throws:
InterpreterException

base_asUnquoteSplice

public ATUnquoteSplice base_asUnquoteSplice()
                                     throws InterpreterException
Specified by:
base_asUnquoteSplice in interface ATConversions
Overrides:
base_asUnquoteSplice in class NATNil
Throws:
InterpreterException

base_asSymbol

public ATSymbol base_asSymbol()
                       throws InterpreterException
Specified by:
base_asSymbol in interface ATConversions
Overrides:
base_asSymbol in class NATNil
Throws:
InterpreterException

base_asSplice

public ATSplice base_asSplice()
                       throws InterpreterException
Specified by:
base_asSplice in interface ATConversions
Overrides:
base_asSplice in class NATNil
Throws:
InterpreterException

base_asDefinition

public ATDefinition base_asDefinition()
                               throws InterpreterException
Specified by:
base_asDefinition in interface ATConversions
Overrides:
base_asDefinition in class NATNil
Throws:
InterpreterException

base_asMessageCreation

public ATMessageCreation base_asMessageCreation()
                                         throws InterpreterException
Specified by:
base_asMessageCreation in interface ATConversions
Overrides:
base_asMessageCreation in class NATNil
Throws:
InterpreterException

isAmbientTalkObject

public boolean isAmbientTalkObject()
Specified by:
isAmbientTalkObject in interface ATConversions
Overrides:
isAmbientTalkObject in class NATNil

base_isMirror

public boolean base_isMirror()
                      throws InterpreterException
Specified by:
base_isMirror in interface ATConversions
Overrides:
base_isMirror in class NATNil
Throws:
InterpreterException

base_isBoolean

public boolean base_isBoolean()
                       throws InterpreterException
Specified by:
base_isBoolean in interface ATConversions
Overrides:
base_isBoolean in class NATNil
Throws:
InterpreterException

base_isClosure

public boolean base_isClosure()
                       throws InterpreterException
Specified by:
base_isClosure in interface ATConversions
Overrides:
base_isClosure in class NATNil
Throws:
InterpreterException

base_isMethod

public boolean base_isMethod()
                      throws InterpreterException
Specified by:
base_isMethod in interface ATConversions
Overrides:
base_isMethod in class NATNil
Throws:
InterpreterException

base_isSplice

public boolean base_isSplice()
                      throws InterpreterException
Specified by:
base_isSplice in interface ATConversions
Overrides:
base_isSplice in class NATNil
Throws:
InterpreterException

base_isSymbol

public boolean base_isSymbol()
                      throws InterpreterException
Specified by:
base_isSymbol in interface ATConversions
Overrides:
base_isSymbol in class NATNil
Throws:
InterpreterException

base_isTable

public boolean base_isTable()
                     throws InterpreterException
Specified by:
base_isTable in interface ATConversions
Overrides:
base_isTable in class NATNil
Throws:
InterpreterException

base_isUnquoteSplice

public boolean base_isUnquoteSplice()
                             throws InterpreterException
Specified by:
base_isUnquoteSplice in interface ATConversions
Overrides:
base_isUnquoteSplice in class NATNil
Throws:
InterpreterException

base_isStripe

public boolean base_isStripe()
                      throws InterpreterException
Specified by:
base_isStripe in interface ATConversions
Overrides:
base_isStripe in class NATNil
Throws:
InterpreterException

isFlagSet

private boolean isFlagSet(byte flag)

setFlag

private void setFlag(byte flag)

unsetFlag

private void unsetFlag(byte flag)

hasLocalMethod

private boolean hasLocalMethod(ATSymbol selector)

getLocalMethod

private ATMethod getLocalMethod(ATSymbol selector)
                         throws InterpreterException
Throws:
InterpreterException

isLocallyStripedWith

private boolean isLocallyStripedWith(ATStripe stripe)
                              throws InterpreterException
Performs a stripe test for this object locally.

Returns:
whether this object is striped with a particular stripe or not.
Throws:
InterpreterException

listTransitiveFields

public static ATField[] listTransitiveFields(ATObject obj)
                                      throws InterpreterException
Auxiliary method to access the fields of an object and all of its super-objects up to (but excluding) nil. Overridden fields of parent objects are not included.

Throws:
InterpreterException

listTransitiveMethods

public static ATMethod[] listTransitiveMethods(ATObject obj)
                                        throws InterpreterException
Auxiliary method to access the methods of an object and all of its super-objects up to (but excluding) nil. Overridden methods of parent objects are not included.

Throws:
InterpreterException