1 19 20 25 26 27 package soot.jimple.toolkits.typing.integer; 28 29 import soot.*; 30 import soot.jimple.*; 31 import soot.util.*; 32 import java.util.*; 33 34 37 class TypeNode 38 { 39 public static final boolean DEBUG = false; 40 41 private final int id; 42 private final Type type; 43 44 public TypeNode(int id, Type type) 45 { 46 this.id = id; 47 this.type = type; 48 49 if(DEBUG) 50 { 51 G.v().out.println("creating node " + this); 52 } 53 } 54 55 56 public int id() 57 { 58 return id; 59 } 60 61 62 public Type type() 63 { 64 return type; 65 } 66 67 public boolean hasAncestor_1(TypeNode typeNode) 68 { 69 if(typeNode == this) 70 return true; 71 72 return ClassHierarchy.v().hasAncestor_1(id, typeNode.id); 73 } 74 75 public boolean hasAncestor_2(TypeNode typeNode) 76 { 77 if(typeNode == this) 78 return true; 79 80 return ClassHierarchy.v().hasAncestor_2(id, typeNode.id); 81 } 82 83 108 109 public TypeNode lca_1(TypeNode typeNode) 110 { 111 return ClassHierarchy.v().lca_1(id, typeNode.id); 112 } 113 114 public TypeNode lca_2(TypeNode typeNode) 115 { 116 return ClassHierarchy.v().lca_2(id, typeNode.id); 117 } 118 119 public TypeNode gcd_1(TypeNode typeNode) 120 { 121 return ClassHierarchy.v().gcd_1(id, typeNode.id); 122 } 123 124 public TypeNode gcd_2(TypeNode typeNode) 125 { 126 return ClassHierarchy.v().gcd_2(id, typeNode.id); 127 } 128 129 public String toString() 130 { 131 if(type != null) 132 { 133 return type + "(" + id + ")"; 134 } 135 136 if(this == ClassHierarchy.v().TOP) 137 { 138 return "TOP" + "(" + id + ")"; 139 } 140 141 if(this == ClassHierarchy.v().R0_1) 142 { 143 return "R0_1" + "(" + id + ")"; 144 } 145 146 if(this == ClassHierarchy.v().R0_127) 147 { 148 return "R0_127" + "(" + id + ")"; 149 } 150 151 if(this == ClassHierarchy.v().R0_32767) 152 { 153 return "R0_32767" + "(" + id + ")"; 154 } 155 156 return "ERROR!!!!"; 157 } 158 } 159 | Popular Tags |