Your browser does not support JavaScript and this site utilizes JavaScript to build content and provide links to additional information. You should either enable JavaScript in your browser settings or use a browser that supports JavaScript in order to take full advantage of this site.
1 30 package org.objectweb.asm.tree.analysis; 31 32 import org.objectweb.asm.Type; 33 34 41 public class BasicValue implements Value { 42 43 public final static Value UNINITIALIZED_VALUE = new BasicValue(null); 44 45 public final static Value INT_VALUE = new BasicValue(Type.INT_TYPE); 46 47 public final static Value FLOAT_VALUE = new BasicValue(Type.FLOAT_TYPE); 48 49 public final static Value LONG_VALUE = new BasicValue(Type.LONG_TYPE); 50 51 public final static Value DOUBLE_VALUE = new BasicValue(Type.DOUBLE_TYPE); 52 53 public final static Value REFERENCE_VALUE = new BasicValue(Type.getType("Ljava/lang/Object;")); 54 55 public final static Value RETURNADDRESS_VALUE = new BasicValue(null); 56 57 private Type type; 58 59 public BasicValue(final Type type) { 60 this.type = type; 61 } 62 63 public Type getType() { 64 return type; 65 } 66 67 public int getSize() { 68 return type == Type.LONG_TYPE || type == Type.DOUBLE_TYPE ? 2 : 1; 69 } 70 71 public boolean isReference() { 72 return type != null 73 && (type.getSort() == Type.OBJECT || type.getSort() == Type.ARRAY); 74 } 75 76 public boolean equals(final Object value) { 77 if (value == this) { 78 return true; 79 } else if (value instanceof BasicValue) { 80 if (type == null) { 81 return ((BasicValue) value).type == null; 82 } else { 83 return type.equals(((BasicValue) value).type); 84 } 85 } else { 86 return false; 87 } 88 } 89 90 public int hashCode() { 91 return type == null ? 0 : type.hashCode(); 92 } 93 94 public String toString() { 95 if (this == UNINITIALIZED_VALUE) { 96 return "."; 97 } else if (this == RETURNADDRESS_VALUE) { 98 return "A"; 99 } else if (this == REFERENCE_VALUE) { 100 return "R"; 101 } else { 102 return type.getDescriptor(); 103 } 104 } 105 }
| Popular Tags
|