Main Page   Packages   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members  

LockNode.java

00001 package gov.nasa.arc.ase.jpf.jvm.runtime;
00002 
00003 import javax.swing.tree.*; 
00004 import java.util.*;
00005 import gov.nasa.arc.ase.jpf.*;
00006 import gov.nasa.arc.ase.jpf.jvm.*;
00007 import gov.nasa.arc.ase.util.Debug;
00008 
00009 public class LockNode extends DefaultMutableTreeNode{
00010 //#endif RACE
00011   public LockNode(Lock lock){
00012     super(new LockNodeInfo(lock));    
00013   }  
00014 // ifdef RACE
00015   public LockNode(ThreadInfo thread){
00016     super(thread);
00017   }  
00018   public LockNodeInfo getLockNodeInfo(){
00019     return (LockNodeInfo)getUserObject();
00020   }  
00021   public ThreadInfo getThreadInfo(){
00022     return (ThreadInfo)((LockNode)getRoot()).getUserObject();
00023   }  
00024   public String getThreadName(){
00025     return getThreadInfo().getClassInfo().getClassName();
00026   }  
00027   public boolean isBelowMark(){
00028     if (isRoot())
00029       return false;
00030     else if (getLockNodeInfo().isMarked())
00031       return true;
00032     else
00033       return ((LockNode)getParent()).isBelowMark();
00034   }  
00035   public void print(){
00036     LockNodeInfo lock_node_info = (LockNodeInfo)getUserObject();
00037     if (lock_node_info != null)
00038       lock_node_info.print();
00039     LockOrder.println("");
00040   }  
00041   private void printPosition(){
00042     TreeNode[] path = getPath();
00043     TreeNode node;
00044     int childnr;
00045     for (int i = 1;i < path.length;i++){
00046       node = path[i];
00047       childnr = node.getParent().getIndex(node);
00048       if (i > 1) LockOrder.print(".");
00049       LockOrder.print(childnr + "");      
00050     };
00051     LockOrder.print("      ");
00052   }  
00053   public void printTreeInfo(){
00054     if (!isRoot()){
00055       printPosition();
00056       getLockNodeInfo().printTreeInfo();
00057     };
00058     LockOrder.println("");
00059   }  
00060   public HashSet setAbove(){
00061     TreeNode[] path = getPath();
00062     HashSet set = new HashSet();
00063     LockNode node;
00064     for (int i = 1;i<path.length-1;i++){
00065       set.add(((LockNode)path[i]).getLockNodeInfo().getLock());
00066     };
00067     return set;
00068   }  
00069 }

Generated at Thu Feb 7 06:49:57 2002 for Bandera by doxygen1.2.10 written by Dimitri van Heesch, © 1997-2001