KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > alt > jiapi > reflect > TargetInstruction


1 /*
2  * Copyright (C) 2001 Mika Riekkinen, Joni Suominen
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  */

18
19 package alt.jiapi.reflect;
20
21 /**
22  * This class represents a Target Instruction.
23  * TargetInstruction is a container for another Instruction.
24  * This is used with BranchInstructions and for other
25  * internal purposes that deal with 'targets'
26  *
27  * @author Mika Riekkinen
28  * @version $Revision: 1.2 $ $Date: 2004/03/25 08:54:46 $
29  */

30 class TargetInstruction extends Instruction {
31     private Instruction target;
32
33     TargetInstruction(Instruction target) {
34         this.target = target;
35     }
36
37     Instruction getTarget() {
38         return target;
39     }
40
41     // Should we make this public?
42
void setTarget(Instruction target) {
43         this.target = target;
44     }
45
46
47
48     // Instruction Methods overloaded follow.
49
// pass each call to 'target'
50
public byte[] getBytes() {
51         return target.getBytes();
52     }
53
54     public byte getOpcode() {
55         return target.getOpcode();
56     }
57
58     public int length() {
59         return target.length();
60     }
61
62     public String JavaDoc toString() {
63         return target.toString();
64     }
65
66     public short stackUsage() {
67         return target.stackUsage();
68     }
69
70     protected void setOffset(short offset) {
71         target.setOffset(offset);
72     }
73
74     protected short getOffset() {
75         return target.getOffset();
76     }
77 }
78
79
80
81
Popular Tags