th.co.edge.jseq
Class ActivationList

java.lang.Object
  extended by th.co.edge.jseq.ActivationList
All Implemented Interfaces:
java.io.Serializable, java.lang.Iterable<Activation>

public class ActivationList
extends java.lang.Object
implements java.io.Serializable, java.lang.Iterable<Activation>

An ActivationList holds a number of Activation instances, representing a number of method calls. This can be used to hold nested method call made by a method, or all root activation, i.e., methods that are not called by one of the traced methods but "magically" from outside the sequence diagram.

See Also:
Serialized Form

Nested Class Summary
static interface ActivationList.Filter
          An interface used by the filter and find methods to determine if an Activation is acceptable or not.
 
Constructor Summary
ActivationList()
           
 
Method Summary
 void add(Activation activation)
          Adds an Activation to this list.
 void addAll(ActivationList activationList)
          Adds all Activations from another ActivationList to this list.
 ActivationList collapseRepetitions()
          Returns an ActivationList where all consecutive identical Activations but the first have been removed, and its numRepetitions property increased accordingly.
 ActivationList copy()
          Performs a deep copy of this ActivationList, copying all Activations and recursively the nested Activations.
 boolean equals(java.lang.Object o)
          Compares this ActivationList to another object, and returns true if and only if the other object is an ActivationList with equal Activations.
 ActivationList filter(ActivationList.Filter filter)
          Returns a new ActivationList containing only the Activations for which the given filter returns true.
 ActivationList find(ActivationList.Filter filter)
          Returns a new ActivationList where the activations and nested activations have been pruned, so as to start with an activation that is accepted by the given filter.
 Activation get(int index)
          Returns the Activation at a certain position in this list.
 int hashCode()
          Returns a hash code for this ActivationList.
 java.util.Iterator<Activation> iterator()
          Returns an iterator that iterates over the Activations in this list, in the order they were added.
 Activation remove(int index)
          Removes an Activation at a certain position in this list.
 void setParent(Activation parent)
          Sets the parent Activation of all Activations in this list to the given value.
 int size()
          Returns the size of this ActivationList.
 java.lang.String toString()
          Returns a string representation of this ActivationList.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ActivationList

public ActivationList()
Method Detail

add

public void add(Activation activation)
Adds an Activation to this list.

Parameters:
activation - the Activation to add

addAll

public void addAll(ActivationList activationList)
Adds all Activations from another ActivationList to this list.

Parameters:
activationList - the ActivationList whose Activations will be added to this list

remove

public Activation remove(int index)
Removes an Activation at a certain position in this list.

Parameters:
index - the position in this list to remove
Returns:
the removed Activation

get

public Activation get(int index)
Returns the Activation at a certain position in this list.

Parameters:
index - the position in this list to return
Returns:
the Activation at position index in this list

size

public int size()
Returns the size of this ActivationList.

Returns:
the size of this list

iterator

public java.util.Iterator<Activation> iterator()
Returns an iterator that iterates over the Activations in this list, in the order they were added.

Specified by:
iterator in interface java.lang.Iterable<Activation>
Returns:
an iterator that iterates over the Activations in this list

filter

public ActivationList filter(ActivationList.Filter filter)
Returns a new ActivationList containing only the Activations for which the given filter returns true. The filtering is also done recursively on nested Activations.

Parameters:
filter - the Filter instance used to determine which Activations should be included
Returns:
a new ActivationList containing only the Activations that filter accepts

find

public ActivationList find(ActivationList.Filter filter)
Returns a new ActivationList where the activations and nested activations have been pruned, so as to start with an activation that is accepted by the given filter. In other words, this method "lifts" activations accepted by the filter to be root activations.

For example, given the following activations:

   m
     m1
       q1
       q2
     m2
   p
     m1
       q3
     p2
 
and a filter that only accepts methods named "m1", the following list would be returned:
   m1
     q1
     q2
   m1
     q3
 

Parameters:
filter - the Filter instance used to determine which Activations should be used as root activations
Returns:
a new ActivationList with Activations accepted by filter as root activations

setParent

public void setParent(Activation parent)
Sets the parent Activation of all Activations in this list to the given value.

Parameters:
parent - the new parent activation

collapseRepetitions

public ActivationList collapseRepetitions()
Returns an ActivationList where all consecutive identical Activations but the first have been removed, and its numRepetitions property increased accordingly.

Returns:
an ActivationList with no repeated identical Activations

copy

public ActivationList copy()
Performs a deep copy of this ActivationList, copying all Activations and recursively the nested Activations.

Returns:
a new ActivationList containing a deep copy of all Activations in this list

toString

public java.lang.String toString()
Returns a string representation of this ActivationList.

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

equals

public boolean equals(java.lang.Object o)
Compares this ActivationList to another object, and returns true if and only if the other object is an ActivationList with equal Activations.

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

hashCode

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

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


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