Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.arjuna.ats.arjuna.coordinator
Class ActionHierarchy

    java.lang.Object
      com.arjuna.ats.arjuna.coordinator.ActionHierarchy

public class ActionHierarchy
extends java.lang.Object

Class that represents the transaction hierarchy. This class can cope with transaction hierarchies of arbitrary depth.

Since:
  1.0.
Version:
  $Id: ActionHierarchy.html,v 1.1 2008/01/04 06:52:39 afitzsim Exp $
Author:
  Mark Little (mark@arjuna.com)

Field Summary
`static int` | `DEFAULT_HIERARCHY_DEPTH`

Constructor Summary
`ActionHierarchy(ActionHierarchy theCopy)` Create a new copy of the specified transaction hierarchy.
`ActionHierarchy(int depth)` Create a new (blank) hierarchy with sufficient space for the specified number of transactions.

Method Summary
`boolean` | `add(Uid actionId)` Insert new entry growing table as needed.
`boolean` | `add(Uid actionId, int at)` Add the transaction id at the specified level.
`void` | `copy(ActionHierarchy c)` Create a copy of the specified transaction hierarchy.
`int` | `depth()` Returns the current depth of the hierarchy.
`boolean` | `equals(ActionHierarchy other)` Overloads Object.equals.
`void` | `finalize()`
`int` | `findCommonPrefix(ActionHierarchy oldHierarchy)` Find common prefix in two hierarchies.
`void` | `forgetDeepest()` Remove the deepest nested transaction from the hierarchy.
`com.arjuna.ats.arjuna.coordinator.ActionInfo` | `getActionInfo(int typeIndex)`
`Uid` | `getActionUid(int typeIndex)`
`Uid` | `getDeepestActionUid()` Returns the transaction id of the most deeply nested transaction.
`boolean` | `isAncestor(Uid target)` Scan hierarchy looking for a particular Uid starting at deepest and going up.
`void` | `pack(OutputBuffer state)` Pack the hierarchy into the buffer.
`void` | `print(java.io.PrintWriter strm)` Print out the transaction hierarchy.
`void` | `unpack(InputBuffer state)` CAREFULLY unpack the 'new' hierarchy.

Methods inherited from class java.lang.Object
`clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### DEFAULT_HIERARCHY_DEPTH

    public static final int DEFAULT_HIERARCHY_DEPTH

See Also:
  Constant Field Values

Constructor Detail

### ActionHierarchy

    public ActionHierarchy(int depth)

  Create a new (blank) hierarchy with sufficient space for the specified number of transactions. Once this space is exhausted, additional space will be obtained dynamically.

### ActionHierarchy

    public ActionHierarchy(ActionHierarchy theCopy)

  Create a new copy of the specified transaction hierarchy.

Method Detail

### finalize

    public void finalize()

### print

    public void print(java.io.PrintWriter strm)

  Print out the transaction hierarchy.

### copy

    public void copy(ActionHierarchy c)

  Create a copy of the specified transaction hierarchy. Any hierarchy currently maintained by this object will be lost in favour of the new hierarchy. We check for self-assignment.

### equals

    public final boolean equals(ActionHierarchy other)

  Overloads Object.equals.

### add

    public final boolean add(Uid actionId)

  Insert new entry growing table as needed. Transaction id will be added as a top-level transaction.

  Returns:
    `true` if successful, `false` otherwise.

### add

    public final boolean add(Uid actionId,
                             int at)

  Add the transaction id at the specified level.

  Returns:
    `true` if successful, `false` otherwise.

### isAncestor

    public final boolean isAncestor(Uid target)

  Scan hierarchy looking for a particular Uid starting at deepest and going up. Do NOT go past any top level action.

  Returns:
    `true` if is ancestor, `false` otherwise.

### pack

    public void pack(OutputBuffer state)
              throws java.io.IOException

  Pack the hierarchy into the buffer.

  Throws:
    `java.io.IOException`

### unpack

    public void unpack(InputBuffer state)
                throws java.io.IOException

  CAREFULLY unpack the 'new' hierarchy. We unpack into a temporary to ensure that the current hierarchy is not corrupted.

  Throws:
    `java.io.IOException`

### forgetDeepest

    public final void forgetDeepest()

  Remove the deepest nested transaction from the hierarchy.

### findCommonPrefix

    public final int findCommonPrefix(ActionHierarchy oldHierarchy)

  Find common prefix in two hierarchies.

  Returns:
    the index of the first common ancestor.

### depth

    public final int depth()

  Returns the current depth of the hierarchy.

  Returns:
    the hierarchy depth.

### getDeepestActionUid

    public final Uid getDeepestActionUid()

  Returns the transaction id of the most deeply nested transaction.

  Returns:
    the `Uid` of the deepest transaction.

### getActionUid

    public final Uid getActionUid(int typeIndex)

  Returns:
    the identity of the transaction at the specified level in the hierarchy.

### getActionInfo

    public final com.arjuna.ats.arjuna.coordinator.ActionInfo getActionInfo(int typeIndex)

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD