th.co.edge.jseq
Class Activation

java.lang.Object
  extended by th.co.edge.jseq.Activation
All Implemented Interfaces:
java.io.Serializable

public class Activation
extends java.lang.Object
implements java.io.Serializable

An Activation represents one method call, or in other words, one stack frame.

See Also:
Serialized Form

Constructor Summary
Activation(Activation parent, java.lang.String className, com.sun.jdi.Method method, int frameCount)
          Creates a new Activation instance, representing a certain method call.
 
Method Summary
 void add(Activation nestedActivation)
          Adds another nested Activation to this Activation.
 Activation copy(Activation parentOfCopy)
          Performs a deep copy of this Activation instance.
 boolean equals(java.lang.Object o)
          Compares this Activation to another object, and returns true if and only if the other object is an Activation with the same class and method names, and equal nested activations.
 java.lang.String getClassName()
          Returns the name of the class that this Activation belongs to.
 int getFrameCount()
          Returns the index number of the stack frame associated with this Association.
 com.sun.jdi.Method getMethod()
          Returns the Method that is being called by this Activation.
 ActivationList getNestedActivations()
          Returns an ActivationList with all nested Activations, that is, all methods called by this method.
 int getNumCalls()
          Returns the number of nested activations.
 int getNumRepetitions()
          Returns the number of times the method represented by this Activation is being called consecutively, with no other calls in between.
 Activation getParent()
          Returns the Activation that called this Activation, or null if this is a root activation.
 int hashCode()
          Returns a hash code for this Activation.
 void increaseNumRepetitions()
          Increases the number of consecutive calls of this method by one.
 void setNestedActivations(ActivationList nestedActivations)
          Sets the ActivationList with all nested Activations called by this method.
 void setParent(Activation parent)
          Sets the Activation that called this Activation.
 java.lang.String toString()
          Returns a string representation of this Activation and all its nested Activations, with each activation on a separate line, and nested activations indented.
 java.lang.String toString(int indent)
          As toString(), but indents the first activation a given number of spaces.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Activation

public Activation(Activation parent,
                  java.lang.String className,
                  com.sun.jdi.Method method,
                  int frameCount)
Creates a new Activation instance, representing a certain method call.

Parameters:
parent - the Activation representing the method that called this method, or null if this is a root activation. The newly created Activation will be added as a nested activation of parent
className - the name of the class that this method call belongs to
method - the Method that is being called
frameCount - the index number of the stack frame associated with this Association
Method Detail

copy

public Activation copy(Activation parentOfCopy)
Performs a deep copy of this Activation instance.

Parameters:
parentOfCopy - the Activation representing the method that called this method, potentially different from the original, or null if the copy is a root activation. The newly created Activation will be added as a nested activation of parentOfCopy
Returns:
a copy of this Activation instance

getParent

public Activation getParent()
Returns the Activation that called this Activation, or null if this is a root activation.

Returns:
the caller of this Activation

setParent

public void setParent(Activation parent)
Sets the Activation that called this Activation.

Parameters:
parent - the caller of this Activation, or null if this is a root activation

getClassName

public java.lang.String getClassName()
Returns the name of the class that this Activation belongs to.

Returns:
the class name of this Activation

getMethod

public com.sun.jdi.Method getMethod()
Returns the Method that is being called by this Activation.

Returns:
the Method represented by this Activation

getFrameCount

public int getFrameCount()
Returns the index number of the stack frame associated with this Association.

Returns:
the index number of this stack frame

getNumRepetitions

public int getNumRepetitions()
Returns the number of times the method represented by this Activation is being called consecutively, with no other calls in between. If this number is greater than one, it may be represented in a sequence diagram in some special way, e.g., "*[3]" for three repetitions.

Returns:
the number of consecutive calls to this method

increaseNumRepetitions

public void increaseNumRepetitions()
Increases the number of consecutive calls of this method by one.


add

public void add(Activation nestedActivation)
Adds another nested Activation to this Activation. This represents a method call made by this method.

Parameters:
nestedActivation - the nested Activation to add to this Activation

getNestedActivations

public ActivationList getNestedActivations()
Returns an ActivationList with all nested Activations, that is, all methods called by this method.

Returns:
an ActivationList with all nested activations.

setNestedActivations

public void setNestedActivations(ActivationList nestedActivations)
Sets the ActivationList with all nested Activations called by this method.

Parameters:
nestedActivations - the new ActivationList with nested activations.

getNumCalls

public int getNumCalls()
Returns the number of nested activations.

Returns:
the number of method calls made by this activation.

toString

public java.lang.String toString()
Returns a string representation of this Activation and all its nested Activations, with each activation on a separate line, and nested activations indented.

Overrides:
toString in class java.lang.Object
Returns:
a string representation of this Activation

toString

public java.lang.String toString(int indent)
As toString(), but indents the first activation a given number of spaces.

Parameters:
indent - the number of spaces to indent the first activation
Returns:
a string representation of this Activation, with the first indented indent number of spaces, and nested activations further indented

equals

public boolean equals(java.lang.Object o)
Compares this Activation to another object, and returns true if and only if the other object is an Activation with the same class and method names, and equal nested activations.

Overrides:
equals in class java.lang.Object
Parameters:
o - the object to compare this Activation to
Returns:
true if o is an Activation with the same class and method names and the equal nested activations, false otherwise

hashCode

public int hashCode()
Returns a hash code for this Activation.

Overrides:
hashCode in class java.lang.Object
Returns:
a hash code for this Activation


Copyright © 2008 Edge Software, Co., Ltd.. All Rights Reserved.