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

public abstract class BR.unicamp.Guarana.SequentialComposerAlgorithms.WithArray

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

The pure class interface.
public abstract class WithArray
  extends WithArrayAndRange
Implements algorithms for Composers like SequentialComposer, that sequentially request a fixed set of MetaObjects to handle Operations, Results and Messages, as well as reconfiguration, configuration, initialize and release requests. It assumes the array of metaObjects given to each of its Operations is constant.

For each method of MetaObject, this class implements a method that takes the additional argument metaObjects, the array of MetaObjects to which it should delegate the requests. Each such method invokes the corresponding method with the additional arguments begin, increment and range, implemented in the class WithArrayAndRange. Begin and end are such that the full array is iterated on, and increment is -1 for handleResult and release, and +1 for all other methods.

All algorithms are final, to avoid exposing the metaObjects array of its main subclass, SequentialComposer. This could have been avoided differently (with final implementations of these methods in class SequentialComposer itself), but it probably wasn't worth the trouble, since there's little point in specializing these methods. They used to be static within SequentialComposer, after all.

See also:
SequentialComposer.

Constuctor Index

O WithArray()

Methods

O composerForArray(MetaObject[])
Invokes composerForArrayWithPolicies
O composerForArrayWithPolicies(MetaObject[], boolean, boolean, boolean)
This method is invoked from composerForArray
O composerForConfigure(Object, Object, MetaObject[])
Invokes composerForArray
O composerForReconfigure(Object, MetaObject, MetaObject, MetaObject[])
Invokes composerForArray
O configure(Object, Object, MetaObject[])
Invokes configureArray and composerForConfigure to determine the MetaObject to be
O configureArray(Object, Object, MetaObject[])
Invokes the corresponding method that takes a range.
O getMetaObjects(MetaObject[])
Invokes the corresponding method that takes a range.
O handleMessage(Message, Object, MetaObject[])
Invokes the corresponding method that takes a range.
O handleOperation(Operation, Object, MetaObject[])
Invokes the corresponding method that takes a range.
O handleResult(Result, Object, MetaObject[])
Invokes the corresponding method that takes a range.
O initialize(OperationFactory, Object, MetaObject[])
Invokes the corresponding method that takes a range.
O newComposer(MetaObject[])
Invoked by composerForArrayWithPolicies, it should create a new Composer that delegates
O reconfigure(Object, MetaObject, MetaObject, MetaObject[])
Invokes reconfigureArray and composerForReconfigure to determine the MetaObject to be
O reconfigureArray(Object, MetaObject, MetaObject, MetaObject[])
Invokes the corresponding method that takes a range.
O release(Object, MetaObject[])
Invokes the corresponding method that takes a range.

Constructors

O WithArray
public WithArray();

Methods

O getMetaObjects
protected final Enumeration getMetaObjects(MetaObject[] metaObjects);
Invokes the corresponding method that takes a range.

See also:
getMetaObjects

O handleOperation

protected final Result handleOperation(Operation operation,
                                       Object object,
                                       MetaObject[] metaObjects);
Invokes the corresponding method that takes a range.

See also:
handleOperation

O handleResult

protected final Result handleResult(Result res,
                                    Object object,
                                    MetaObject[] metaObjects);
Invokes the corresponding method that takes a range.

See also:
handleResult

O handleMessage

protected final void handleMessage(Message message,
                                   Object object,
                                   MetaObject[] metaObjects);
Invokes the corresponding method that takes a range.

See also:
handleMessage

O configureArray

protected final MetaObject[] configureArray(Object newObject,
                                            Object object,
                                            MetaObject[] metaObjects);
Invokes the corresponding method that takes a range.

See also:
configureArray

O configure

protected MetaObject configure(Object newObject,
                               Object object,
                               MetaObject[] metaObjects);
Invokes configureArray and composerForConfigure to determine the MetaObject to be returned.

See also:
configure, composerForConfigure

O reconfigureArray

protected final MetaObject[] reconfigureArray(Object object,
                                              MetaObject oldMetaObject,
                                              MetaObject newMetaObject,
                                              MetaObject[] metaObjects);
Invokes the corresponding method that takes a range.

See also:
reconfigureArray

O reconfigure

protected synchronized MetaObject reconfigure(Object object,
                                              MetaObject oldMetaObject,
                                              MetaObject newMetaObject,
                                              MetaObject[] metaObjects);
Invokes reconfigureArray and composerForReconfigure to determine the MetaObject to be returned.

It is worth noting that this implementation disregards requests to reconfigure itself, i.e., with oldMetaObject == this or null, blindly passing them on to components. Subclasses should take care of such reconfigurations, if appropriate.

See also:
reconfigureArray, composerForReconfigure

O initialize

protected final void initialize(OperationFactory factory,
                                Object object,
                                MetaObject[] metaObjects);
Invokes the corresponding method that takes a range.

See also:
initialize

O release

protected final void release(Object object,
                             MetaObject[] metaObjects);
Invokes the corresponding method that takes a range.

See also:
release

O composerForConfigure

protected MetaObject composerForConfigure(Object newObject,
                                          Object object,
                                          MetaObject[] metaObjects);
Invokes composerForArray. This method is called from configure after the new array of metaObjects is determined.

Overriders of this method may invoke composerForArrayWithPolicies directly, with policies different from the default.

Parameters:
newObject - the Object for which a new Composer should be provided. Unused in the current implementation. It may be useful for subclasses.
object - the Object whose meta-configuration is being requested to create the newObject's meta-configuration. Unused in the current implementation. It may be useful for subclasses.
metaObjects - the array of MetaObjects determined by the configure process (possibly null).
See also:
composerForArray, configure

O composerForReconfigure

protected MetaObject composerForReconfigure(Object object,
                                            MetaObject oldMetaObject,
                                            MetaObject newMetaObject,
                                            MetaObject[] metaObjects);
Invokes composerForArray. This method is called from configure after the new array of metaObjects is determined.

Overriders of this method may invoke composerForArrayWithPolicies directly, with policies different from the default.

Parameters:
object - the Object whose meta-configuration is being modified. Unused in the current implementation. It may be useful for subclasses.
oldMetaObject - the MetaObject to be replaced. Unused in the current implementation. It may be useful for subclasses.
newMetaObject - the MetaObject to replace it. Unused in the current implementation. It may be useful for subclasses.
metaObjects - the array of MetaObjects determined by the reconfigure process (possibly null).
See also:
composerForArray, reconfigure

O composerForArray

protected MetaObject composerForArray(MetaObject[] metaObjects);
Invokes composerForArrayWithPolicies. This method is called from composerForConfigure and composerForReconfigure.

Overriders of this method may invoke composerForArrayWithPolicies directly, with policies different from the default.

Parameters:
metaObjects - the array of MetaObjects determined by the configure or reconfigure process (possibly null).
Returns:
a MetaObject (typically a Composer) that delegates to the given metaObjects.
See also:
composerForArrayWithPolicies, composerForConfigure, composerForReconfigure

O composerForArrayWithPolicies

protected MetaObject composerForArrayWithPolicies(MetaObject[] metaObjects,
                                                  boolean may_propagate_itself,
                                                  boolean may_leave_when_empty,
                                                  boolean may_leave_when_unitary);
This method is invoked from composerForArray. It uses newComposer to create the new Composer, when appropriate.

Parameters:
metaObjects - the array of MetaObjects determined by the configure or reconfigure process (possibly null).
may_propagate_itself - indicates whether this method should return this if the given array is exactly the one the Composer delegates to. Enabling this is useful for reconfigurations that don't change any MetaObject, but, in some cases, it should be disabled for configurations. This test is not implemented in this abstract class, since it can't tell what the original array is, but subclasses are encouraged to implement it.
may_leave_when_empty - indicates whether this method should return null when it gets a null array, or an array with length 0. If the argument is false, a new Composer will be created with an array of length zero.
may_leave_when_unitary - indicates whether this method should return the only element of the array, when it finds the array is unitary. If the argument is false, a new Composer will be created with the unitary array.
Returns:
a MetaObject (typically a Composer) that delegates to the given metaObjects.
See also:
composerForArray, composerForConfigure, composerForReconfigure, newComposer

O newComposer

protected abstract MetaObject newComposer(MetaObject[] metaObjects);
Invoked by composerForArrayWithPolicies, it should create a new Composer that delegates to the given array of metaObjects.

Parameters:
metaObjects - the set of MetaObjects the new Composer should delegate to.
Returns:
the new Composer.


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