MATES 3.0-rc2

org.mates.util
Class Bundle

java.lang.Object
  extended byorg.mates.util.Bundle
All Implemented Interfaces:
java.lang.Cloneable
Direct Known Subclasses:
Topology.TopologyBundle

public class Bundle
extends java.lang.Object
implements java.lang.Cloneable

A data encapsulator class for automating concurrent processes. This is the main data structure used by the BatchProcessor architecture.

It is possible to extend this class, however not necessary. Most extensions of this class will need to re-implement the clone() function, as this is used in BatchProcessor.process(Bundle) to create new Bundles for each of the processing threads.

Author:
Evan Sultanik

Nested Class Summary
protected  class Bundle.BundleIterator
          An iterator class for a Bundle.
 
Constructor Summary
Bundle()
          Default constructor.
Bundle(int data_offset, int data_range, java.lang.Object payload)
          Conveniance constructor.
 
Method Summary
protected  java.lang.Object clone()
          Creates a copy of this bundle.
 java.util.Iterator elements()
          Returns an iterator for the current list this bundle is a member of.
 int getDataOffset()
          Accessor for the data offset.
 int getDataRange()
          Accessor for the data range.
 Bundle getNext()
          Returns the next Bundle in the current list.
 java.lang.Object getPayload()
          Returns the payload of this bundle.
 void insertAfter(Bundle bundle)
          Inserts a bundle in the current list between this and this.
 void setDataOffset(int offset)
          Sets the data offset.
 void setDataRange(int range)
          Sets the data range.
 void setPayload(java.lang.Object payload)
          Sets the payload of this bundle.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Bundle

public Bundle()
Default constructor.


Bundle

public Bundle(int data_offset,
              int data_range,
              java.lang.Object payload)
Conveniance constructor.

Method Detail

clone

protected java.lang.Object clone()
Creates a copy of this bundle. Everything but the payload is cloned.


setDataOffset

public void setDataOffset(int offset)
Sets the data offset.


getDataOffset

public int getDataOffset()
Accessor for the data offset.


getDataRange

public int getDataRange()
Accessor for the data range.


setDataRange

public void setDataRange(int range)
Sets the data range.


setPayload

public void setPayload(java.lang.Object payload)
Sets the payload of this bundle. This is simply for a conveniance; the payload is not required at all for the successful execution of BatchProcessor.process(Bundle). The payload of a bundle is generally not cloned during clone(). This is one way of collecting batch processing results; each processor can add the resulting object to this bundle, which, in turn, gets appended to the input bundle to BatchProcessor.process(Bundle).


getPayload

public java.lang.Object getPayload()
Returns the payload of this bundle.

See Also:
setPayload(Object)

elements

public java.util.Iterator elements()
Returns an iterator for the current list this bundle is a member of. Every bundle is a member of a doubly-linked list containing one bundle per data "chunk" that was parallelized. For example, this linked list is then concatenated on the end of the bundle passed to BatchProcessor.process(Bundle).

See Also:
BatchProcessor

getNext

public Bundle getNext()
Returns the next Bundle in the current list.

See Also:
elements()

insertAfter

public void insertAfter(Bundle bundle)
Inserts a bundle in the current list between this and this.getNext().

Parameters:
bundle - the bundle to be inserted in the list.

MATES 3.0-rc2

Submit a bug or request a feature
http://mates.sourceforge.net/

Copyright 2004 Evan Sultanik