edu.vub.at.objects.mirrors
Class NATIntercessiveMirror

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
                  extended byedu.vub.at.objects.mirrors.NATIntercessiveMirror
All Implemented Interfaces:
ATAbstractGrammar, ATConversions, ATExpression, ATMirror, ATNil, ATObject, ATStatement, java.io.Serializable

public class NATIntercessiveMirror
extends NATObject
implements ATMirror

NATIntercessiveMirror extends the default NATIntrospectiveMirror to also allow programmers to supply their own code for the meta-operations defined on an object. This offers the programmers a way to intercede the default semantics implemented in the language for the scope of a single object

To achieve this, a triplet of objects is needed : first of all, instead of using a default object (whose behaviour is hardwired for efficiency), a mirage needs to be used, to reify the meta-operations called upon an object. These meta-operations are invoked on an ordinary object, which delegates to an instance of this class to implement the correct default behaviour.

Author:
smostinc
See Also:
Serialized Form

Field Summary
protected  NATMirage principal_
           
 
Fields inherited from class edu.vub.at.objects.natives.NATObject
_EQL_NAME_, _INI_NAME_, _IS_A_, _NEW_NAME_, _NO_STRIPES_, _SHARES_A_, _SUPER_NAME_, stripes_
 
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
  NATIntercessiveMirror(ATObject lexicalParent, boolean parentType)
          Constructs a new ambienttalk mirror based on a set of parent pointers.
protected NATIntercessiveMirror(FieldMap map, java.util.Vector state, java.util.LinkedList customFields, MethodDictionary methodDict, ATObject dynamicParent, ATObject lexicalParent, byte flags, ATStripe[] stripes, NATMirage base)
          Constructs a new ambienttalk mirage as a clone of an existing one.
  NATIntercessiveMirror(NATIntercessiveMirror dynamicParent, ATObject lexicalParent, boolean parentType)
          Constructs a new ambienttalk mirror based on a set of parent pointers.
 
Method Summary
 ATMirror base_asMirror()
           
 ATObject base_getBase()
          Provides access to the AmbientTalk language value this mirror reflects upon.
 boolean base_isMirror()
           
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 customFields, MethodDictionary methodDict, ATObject dynamicParent, ATObject lexicalParent, byte flags, ATStripe[] stripes)
           
 NATIntercessiveMirror magic_clone()
           
 ATObject meta_clone()
          Clone the receiver object.
 ATTable meta_getStripes()
          Returns the stripes of this object.
 NATText meta_print()
          Prints out the object in a human-readable way.
 ATNil setBase(NATMirage base)
           
 
Methods inherited from class edu.vub.at.objects.natives.NATObject
asAmbientTalkObject, base_asActorMirror, base_asAsyncMessage, base_asBegin, base_asBoolean, base_asClosure, base_asDefinition, base_asExpression, base_asField, base_asHandler, base_asMessage, base_asMessageCreation, base_asMethod, base_asNumber, base_asSplice, base_asStatement, base_asStripe, base_asSymbol, base_asTable, base_asUnquoteSplice, base_isBoolean, base_isCallFrame, base_isClosure, base_isMethod, base_isSplice, base_isStripe, base_isSymbol, base_isTable, base_isUnquoteSplice, createIsolate, isAmbientTalkObject, isPrimitive, listTransitiveFields, listTransitiveMethods, meta_addMethod, meta_assignField, meta_defineField, meta_extend, meta_grabMethod, meta_invoke, meta_isCloneOf, meta_isRelatedTo, meta_isStripedWith, meta_listMethods, meta_lookup, meta_newInstance, meta_pass, meta_resolve, meta_respondsTo, meta_select, meta_share
 
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_addMethod, meta_assignField, meta_assignVariable, meta_defineField, meta_doesNotUnderstand, meta_eval, meta_extend, meta_getDynamicParent, meta_getLexicalParent, meta_grabField, meta_grabMethod, meta_invoke, meta_isCloneOf, meta_isRelatedTo, meta_isStripedWith, meta_listFields, meta_listMethods, meta_lookup, meta_newInstance, meta_pass, meta_quote, meta_receive, meta_resolve, meta_respondsTo, meta_select, meta_send, meta_share
 
Methods inherited from interface edu.vub.at.objects.coercion.ATConversions
asAmbientTalkObject, asJavaClassUnderSymbiosis, asJavaObjectUnderSymbiosis, asNativeBoolean, asNativeException, asNativeFarReference, asNativeFraction, asNativeNumber, asNativeNumeric, asNativeTable, asNativeText, base_asActorMirror, base_asAsyncMessage, base_asBegin, base_asBoolean, base_asClosure, base_asDefinition, base_asExpression, base_asFarReference, base_asField, base_asHandler, base_asMessage, base_asMessageCreation, base_asMethod, base_asNumber, base_asSplice, base_asStatement, base_asStripe, base_asSymbol, base_asTable, base_asUnquoteSplice, base_asVariableAssignment, base_isBoolean, base_isCallFrame, base_isClosure, base_isFarReference, base_isMessageCreation, base_isMethod, base_isSplice, base_isStripe, base_isSymbol, base_isTable, base_isUnquoteSplice, base_isVariableAssignment, isAmbientTalkObject, isJavaObjectUnderSymbiosis, isNativeBoolean, isNativeField, isNativeText
 

Field Detail

principal_

protected NATMirage principal_
Constructor Detail

NATIntercessiveMirror

public NATIntercessiveMirror(ATObject lexicalParent,
                             boolean parentType)
Constructs a new ambienttalk mirror based on a set of parent pointers.

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

NATIntercessiveMirror

public NATIntercessiveMirror(NATIntercessiveMirror dynamicParent,
                             ATObject lexicalParent,
                             boolean parentType)
Constructs a new ambienttalk mirror based on a set of parent pointers.

Parameters:
dynamicParent - - the dynamic parent of the new mirror, which should also be a mirror
lexicalParent - - the lexical scope in which the mirror's definition was nested
parentType - - how this object extends its dynamic parent (is-a or shares-a)

NATIntercessiveMirror

protected NATIntercessiveMirror(FieldMap map,
                                java.util.Vector state,
                                java.util.LinkedList customFields,
                                MethodDictionary methodDict,
                                ATObject dynamicParent,
                                ATObject lexicalParent,
                                byte flags,
                                ATStripe[] stripes,
                                NATMirage base)
                         throws InterpreterException
Constructs a new ambienttalk mirage as a clone of an existing one.

Method Detail

base_getBase

public ATObject base_getBase()
Description copied from interface: ATMirror
Provides access to the AmbientTalk language value this mirror reflects upon.

Specified by:
base_getBase in interface ATMirror
Returns:
a base-level AmbientTalk object.

setBase

public ATNil setBase(NATMirage base)

base_isMirror

public boolean base_isMirror()
Specified by:
base_isMirror in interface ATConversions
Overrides:
base_isMirror in class NATObject
Returns:
true

base_asMirror

public ATMirror base_asMirror()
Specified by:
base_asMirror in interface ATConversions
Overrides:
base_asMirror in class NATObject
Returns:
this

meta_clone

public ATObject meta_clone()
                    throws InterpreterException
Description copied from interface: ATObject
Clone the receiver object. This cloning closely corresponds to the allocation phase in class-based OO languages. In class-based languages, instance creation is based on the equation = () (i.e. first allocate a new instance, then initialize it). In our object-based model, allocation is replaced by cloning. When an object is asked to clone itself, it will also clone its dynamic parent if it extends this parent in an 'is-a' relationship. This is similar to the observation that, in class-based languages, allocating a new object of a subclass entails allocating space for the state of the superclass. Triggers the objectCloned event on this object's beholders (mirror observers). Initializing the clone is the responsibility of the method named .

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

magic_clone

public NATIntercessiveMirror magic_clone()
                                  throws InterpreterException
Throws:
InterpreterException

createClone

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

createChild

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

Overrides:
createChild in class NATObject
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 NATObject
Throws:
InterpreterException

meta_getStripes

public ATTable meta_getStripes()
                        throws InterpreterException
Description copied from interface: ATObject
Returns the stripes of this object. Note that only the stripes that were attached directly to this object are returned, not all of the parent's stripes as well.

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