[all packages] [package BR.unicamp.Guarana] [class hierarchy] [index]

public final class BR.unicamp.Guarana.Operation

(source file: /home/lsd/oliva/src/java/guarana/kaffe/libraries/extensions/guarana/javalib/BR/unicamp/Guarana/Operation.java)
java.lang.Object
   |
   +----BR.unicamp.Guarana.Operation

The pure class interface.
public final class Operation
A meta-level representation of an Operation. There are only two ways an Operation can be created: it is either reified from the base level or created by an OperationFactory.

See also:
OperationFactory

Variables Index

O array
If ((op.getOpType() & Operation.array) != 0), op is either an array element
O arrayLength
If (op.getOpType() == Operation.arrayLength), op is an array length Operation.
O arrayMask
If ((op.getOpType() & Operation.arrayMask) == Operation.array), op is either an
O arrayRead
If (op.getOpType() == arrayRead), op is an array element read Operation.
O arrayWrite
If (op.getOpType() == arrayWrite), op is an array element write Operation.
O constructorInvocation
If (op.getOpType() == Operation.constructorInvocation), op is a
O field
If ((op.getOpType() & Operation.field) != 0), op is either a field read or a
O fieldRead
If (op.getOpType() == fieldRead), op is a field read Operation.
O fieldWrite
If (op.getOpType() == fieldWrite), op is a field write Operation.
O invocation
If ((op.getOpType() & Operation.invocation) != 0), op is either a method or a
O methodInvocation
If (op.getOpType() == Operation.methodInvocation), op is a method invocation.
O monitorEnter
If (op.getOpType() == Operation.monitorEnter), op is a monitor enter Operation.
O monitorExit
If (op.getOpType() == Operation.monitorExit), op is a monitor exit Operation.
O nop
If (op.getOpType() == nop), op is a do-nothing operation.
O read
If ((op.getOpType() & Operation.readWriteMask) == Operation.read), op is either
O readWriteMask
Should be used as a bit mask to check whether an operation is a read operation or a write
O synchronization
If ((op.getOpType() & Operation.synchronization) != 0), op is either a monitor
O write
If ((op.getOpType() & Operation.readWriteMask) == Operation.write), op is either

Methods

O getArguments()
Obtains the argument list to be used when invoking a Method or a Constructor
O getArrayIndex()
Obtains the array index this Operation reads from or writes to.
O getConstructor()
Obtains the constructor that will be invoked by this Operation.
O getField()
Obtains the Field this Operation reads from or writes to.
O getMetaObjectInfo(MetaObject)
Obtains MetaObject-specific information previously stored by setMetaObjectInfo().
O getMethod()
Obtains the method that will be invoked by this Operation.
O getObject()
Obtains the target Object of the Operation.
O getOpType()
Obtains a numeric value that may be used to check whether the Operation is a method or
O getOriginal()
Obtains the original Operation from a replacement chain
O getReplaced()
Obtains the Operation this Operation replaced.
O getThread()
Obtains the Thread in which this Operation is to be executed.
O getType()
Obtains the expected type of the result of an Operation. Constructor invocations and
O getValue()
Obtains the value that will be written to the Field or Array element.
O isArrayLengthOperation()
Checks whether this is an Array length Operation.
O isArrayOperation()
Checks whether this is an Array element read or write Operation.
O isClassOperation()
Checks whether the Operation is a static method invocation or static field access.
O isConstructorInvocation()
Checks whether this is a constructor invocation Operation.
O isFieldOperation()
Checks whether this is a field Operation
O isMethodInvocation()
Checks whether this is a method invocation Operation.
O isMonitorEnter()
Checks whether this is a monitor enter Operation.
O isMonitorExit()
Checks whether this is a monitor exit Operation.
O isReadOperation()
Checks whether this is a field or array element read or array length Operation.
O isReplacement()
Checks whether this is a replacement Operation.
O isSynchronization()
Checks whether this is a synchronization Operation.
O isWriteOperation()
Checks whether this is a field or array element write Operation.
O perform()
Just an alternate way of calling Guarana.perform(this).
O replaced(Operation)
Checks whether an Operation is the same as or a replacement of the given Operation.
O setMetaObjectInfo(MetaObject, Object)
Stores MetaObject-specific information in the Operation
O toString()
Returns a String representation of the Operation.
O validate()
Checks whether it is a valid Operation, that is, one that can be performed.

Variables

O nop
public static final int nop;
If (op.getOpType() == nop), op is a do-nothing operation.

O invocation

public static final int invocation;
If ((op.getOpType() & Operation.invocation) != 0), op is either a method or a constructor invocation.

O methodInvocation

public static final int methodInvocation;
If (op.getOpType() == Operation.methodInvocation), op is a method invocation.

O constructorInvocation

public static final int constructorInvocation;
If (op.getOpType() == Operation.constructorInvocation), op is a constructor invocation.

O synchronization

public static final int synchronization;
If ((op.getOpType() & Operation.synchronization) != 0), op is either a monitor enter or a monitor exit Operation.

O monitorEnter

public static final int monitorEnter;
If (op.getOpType() == Operation.monitorEnter), op is a monitor enter Operation.

O monitorExit

public static final int monitorExit;
If (op.getOpType() == Operation.monitorExit), op is a monitor exit Operation.

O read

public static final int read;
If ((op.getOpType() & Operation.readWriteMask) == Operation.read), op is either a field read, an array element read or an array length Operation.

O write

public static final int write;
If ((op.getOpType() & Operation.readWriteMask) == Operation.write), op is either a field write or an array element write Operation.

O readWriteMask

public static final int readWriteMask;
Should be used as a bit mask to check whether an operation is a read operation or a write operation. If ((op.getOpType() & Operation.readWriteMask) == 0), op is neither a read nor a write Operation.

O field

public static final int field;
If ((op.getOpType() & Operation.field) != 0), op is either a field read or a field write Operation.

O array

public static final int array;
If ((op.getOpType() & Operation.array) != 0), op is either an array element read, an array element write or an array length Operation.

O arrayMask

public static final int arrayMask;
If ((op.getOpType() & Operation.arrayMask) == Operation.array), op is either an array element read or an array element write Operation.

O arrayLength

public static final int arrayLength;
If (op.getOpType() == Operation.arrayLength), op is an array length Operation.

O fieldRead

public static final int fieldRead;
If (op.getOpType() == fieldRead), op is a field read Operation.

O fieldWrite

public static final int fieldWrite;
If (op.getOpType() == fieldWrite), op is a field write Operation.

O arrayRead

public static final int arrayRead;
If (op.getOpType() == arrayRead), op is an array element read Operation.

O arrayWrite

public static final int arrayWrite;
If (op.getOpType() == arrayWrite), op is an array element write Operation.

Methods

O perform
public Result perform();
Just an alternate way of calling Guarana.perform(this).

Returns:
the Result of the Operation.
See also:
perform

O validate

public native void validate()
  throws NoSuchMethodError, AbstractMethodError, IllegalArgumentException, NoSuchFieldError, ArrayIndexOutOfBoundsException;
Checks whether it is a valid Operation, that is, one that can be performed.

Throws:
NoSuchMethodError -if the target Object is not an instance of the Class that declares the Method or the Constructor.
AbstractMethodError -if the Method is abstract.
IllegalArgumentException -if the argument types do not match the Method or Constructor signature, or the number of arguments does not match.
NoSuchFieldError -if the target Object is not an instance of the Class that declares the Field.
IllegalArgumentException -if the value to be stored in the Field or array element is not assignable to the Field type.
IllegalArgumentException -if the target Object is not an Array, but the Operation is an Array Operation.
ArrayIndexOutOfBoundsException -if the specified array element does not exist.

O getObject

public native Object getObject();
Obtains the target Object of the Operation.

Returns:
the target Object.

O getThread

public native Thread getThread();
Obtains the Thread in which this Operation is to be executed.

Returns:
the Thread that should execute this Operation.

O getType

public native Class getType();
Obtains the expected type of the result of an Operation. Constructor invocations and synchronization operations, as well as field and array element write operations, are assumed to return void. Array length Operations always return int.

Returns:
the type the Operation is expected to Result under normal control flow.

O isClassOperation

public native boolean isClassOperation();
Checks whether the Operation is a static method invocation or static field access.

Note: synchronization Operations are never considered static, since an invocation of a synchronized static method enters the monitor associated with the Class object that represents the class.

Returns:
true if and only if the method to be invoked or the field to be accessed is static.

O getOpType

public native int getOpType();
Obtains a numeric value that may be used to check whether the Operation is a method or constructor invocation, a synchronization Operation, a field or array element read or write Operation, or an array length Operation.

O isMethodInvocation

public native boolean isMethodInvocation();
Checks whether this is a method invocation Operation.

Returns:
true if and only if this is a method invocation Operation.

O getMethod

public native Method getMethod();
Obtains the method that will be invoked by this Operation.

Returns:
the method to be invoked, or null if this is not a method invocation Operation.

O isConstructorInvocation

public native boolean isConstructorInvocation();
Checks whether this is a constructor invocation Operation.

Returns:
true if and only if this is a constructor invocation Operation.

O getConstructor

public native Constructor getConstructor();
Obtains the constructor that will be invoked by this Operation.

Returns:
the constructor to be invoked, or null if this is not a constructor invocation Operation.

O getArguments

public native Object[] getArguments();
Obtains the argument list to be used when invoking a Method or a Constructor. Changing the references in the returned array has no effect on the invocation, but the references are to the actual arguments, so any Operation that changes such Objects will affect the actual invocation.

Returns:
the argument list that will be passed to the Method or to the Constructor, as an array of Objects, or null if this is not a Method nor Constructor invocation Operation.

O isSynchronization

public native boolean isSynchronization();
Checks whether this is a synchronization Operation.

Returns:
true if and only if this is a synchronization Operation.

O isMonitorEnter

public native boolean isMonitorEnter();
Checks whether this is a monitor enter Operation.

Returns:
true if and only if this is a monitor enter Operation.

O isMonitorExit

public native boolean isMonitorExit();
Checks whether this is a monitor exit Operation.

Returns:
true if and only if this is a monitor exit Operation.

O isReadOperation

public native boolean isReadOperation();
Checks whether this is a field or array element read or array length Operation.

Returns:
true if and only if this is a field or array element read or array length Operation.

O isWriteOperation

public native boolean isWriteOperation();
Checks whether this is a field or array element write Operation.

Returns:
true if and only if this is a field or array element change Operation.

O isFieldOperation

public native boolean isFieldOperation();
Checks whether this is a field Operation. Array Operations are not considered Field Operations

Returns:
true if and only if this is a field Operation.

O getField

public native Field getField();
Obtains the Field this Operation reads from or writes to.

Returns:
the Field, or null if this is not a Field Operation.

O isArrayOperation

public native boolean isArrayOperation();
Checks whether this is an Array element read or write Operation.

Returns:
true if and only if this is an Array element read or write Operation.

O isArrayLengthOperation

public native boolean isArrayLengthOperation();
Checks whether this is an Array length Operation.

Returns:
true if and only if this is the Operation that obtains the length of an Array.

O getArrayIndex

public native int getArrayIndex();
Obtains the array index this Operation reads from or writes to.

Returns:
the array index, or -1 if this is not an array Operation.

O getValue

public native Object getValue();
Obtains the value that will be written to the Field or Array element.

Returns:
the value to be written, or null if this is not a Write Operation. The only way to distinguish between a non-Write Operation and a null value to be written is by invoking isWriteOperation().
See also:
isWriteOperation

O isReplacement

public native boolean isReplacement();
Checks whether this is a replacement Operation.

Returns:
true if and only if this is a replacement Operation.

O getReplaced

public native Operation getReplaced();
Obtains the Operation this Operation replaced.

Returns:
a reference to the replaced Operation, or null if this is not a replacement one.

O replaced

public boolean replaced(Operation operation);
Checks whether an Operation is the same as or a replacement of the given Operation.

Parameters:
operation - the Operation that should be looked for in the replacement chain.
Returns:
true if the Operation is found, false otherwise.

O getOriginal

public Operation getOriginal();
Obtains the original Operation from a replacement chain. That is, if Operation n replaced Operation n-1 that replaced Operation n-2 ... that replaced Operation 1, obtain Operation 1.

Returns:
the last Operation in a replacement chain.

O setMetaObjectInfo

public Object setMetaObjectInfo(MetaObject metaObject,
                                Object object);
Stores MetaObject-specific information in the Operation. A previously-stored Object can be obtained with getMetaObjectInfo().

Parameters:
metaObject - the MetaObject with which the Object is associated.
object - the Object to be associated with the MetaObject.
Returns:
the Object previously associated with metaObject, or null.
See also:
getMetaObjectInfo

O getMetaObjectInfo

public Object getMetaObjectInfo(MetaObject metaObject);
Obtains MetaObject-specific information previously stored by setMetaObjectInfo().

Parameters:
metaObject - the MetaObject whose associated Object is to be returned.
Returns:
the Object previously associated with metaObject, or null.
See also:
setMetaObjectInfo

O toString

public String toString();
Returns a String representation of the Operation.

Throws:
IllegalArgumentException -if getOpType() returns an invalid Operation type.
Overrides:
toString in class Object


[all packages] [package BR.unicamp.Guarana] [class hierarchy] [index]
BR.unicamp.Guarana.Operation.html