01: // Copyright (c) 1997 Per M.A. Bothner.
02: // This is free software; for terms and warranty disclaimer see ./COPYING.
03:
04: package gnu.bytecode;
05:
06: /** An abstracted "variable", inherited by Field and Variable. */
07:
08: public class Location {
09: protected String name;
10: protected Type type;
11: int name_index; /* Index in constant table, or 0 if un-assigned */
12: int signature_index; /* Index in constant table, or 0 if un-assigned */
13:
14: public final String getName() {
15: return name;
16: }
17:
18: public final void setName(String name) {
19: this .name = name;
20: }
21:
22: public final void setName(int name_index, ConstantPool constants) {
23: if (name_index <= 0)
24: name = null;
25: else {
26: CpoolUtf8 nameConstant = (CpoolUtf8) constants.getForced(
27: name_index, ConstantPool.UTF8);
28: name = nameConstant.string;
29: }
30: this .name_index = name_index;
31: }
32:
33: public final Type getType() {
34: return type;
35: }
36:
37: public final void setType(Type type) {
38: this .type = type;
39: }
40:
41: public final String getSignature() {
42: return type.getSignature();
43: }
44:
45: public void setSignature(int signature_index, ConstantPool constants) {
46: CpoolUtf8 sigConstant = (CpoolUtf8) constants.getForced(
47: signature_index, ConstantPool.UTF8);
48: this.signature_index = signature_index;
49: type = Type.signatureToType(sigConstant.string);
50: }
51: }
|