javatools.administrative
Class CallStack

java.lang.Object
  extended by javatools.administrative.CallStack

public class CallStack
extends java.lang.Object

This class is part of the Java Tools (see http://mpii.de/yago-naga/javatools). It is licensed under the Creative Commons Attribution License (see http://creativecommons.org/licenses/by/3.0) by the YAGO-NAGA team (see http://mpii.de/yago-naga). This class represents the current position of a program, i.e. the stack of methods that have been called together with the line numbers.
Example:

   public class Blah {
     public m2() { 
       System.out.println(new CallStack());   // (1)
       System.out.println(CallStack.here());  // (2)
     }

     public m1() { 
       m2(); 
     }

     public static void main(String[] args) { 
       m1(); 
     }
   }
   -->
      Blah.main(12)->Blah.m1(8)->Blah.m2(2)  // Call Stack at (1)
      Blah.m2(3)                             // Method and line number at (2)


Constructor Summary
CallStack()
          Constructs a call stack from the current program position (without the constructor call)
 
Method Summary
 boolean equals(java.lang.Object o)
          Returns TRUE if the two call stacks have the same elements
 java.util.Stack<java.lang.StackTraceElement> getCallstack()
          Returns the callstack
static java.lang.StackTraceElement here()
          Gives the calling position
static void main(java.lang.String[] args)
          Test routine
 CallStack ret()
          Pops the top level of this callstack, returns this callstack
 java.lang.StackTraceElement top()
          Gives the calling position as a StackTraceElement
 java.lang.String toString()
          Returns "method(line)->method(line)->..."
static java.lang.String toString(java.lang.StackTraceElement e)
          Returns a nice String for a Stacktraceelement
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CallStack

public CallStack()
Constructs a call stack from the current program position (without the constructor call)

Method Detail

equals

public boolean equals(java.lang.Object o)
Returns TRUE if the two call stacks have the same elements

Overrides:
equals in class java.lang.Object

toString

public static java.lang.String toString(java.lang.StackTraceElement e)
Returns a nice String for a Stacktraceelement


toString

public java.lang.String toString()
Returns "method(line)->method(line)->..."

Overrides:
toString in class java.lang.Object

top

public java.lang.StackTraceElement top()
Gives the calling position as a StackTraceElement


here

public static java.lang.StackTraceElement here()
Gives the calling position


getCallstack

public java.util.Stack<java.lang.StackTraceElement> getCallstack()
Returns the callstack


ret

public CallStack ret()
Pops the top level of this callstack, returns this callstack


main

public static void main(java.lang.String[] args)
Test routine