KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > jode > flow > Jump


1 /* Jump Copyright (C) 1998-2002 Jochen Hoenicke.
2  *
3  * This program is free software; you can redistribute it and/or modify
4  * it under the terms of the GNU Lesser General Public License as published by
5  * the Free Software Foundation; either version 2, or (at your option)
6  * any later version.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU Lesser General Public License
14  * along with this program; see the file COPYING.LESSER. If not, write to
15  * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
16  *
17  * $Id: Jump.java,v 3.12.2.1 2002/05/28 17:34:09 hoenicke Exp $
18  */

19
20 package jode.flow;
21 import jode.GlobalOptions;
22
23 /**
24  * This class represents an unconditional jump.
25  */

26 public class Jump {
27     /**
28      * The structured block that precedes this jump.
29      */

30     StructuredBlock prev;
31     /**
32      * The destination block of this jump, null if not known, or illegal.
33      */

34     FlowBlock destination;
35
36     /**
37      * The jumps in a flow block, that have the same destination, are
38      * in a link list. This field points to the next jump in this link.
39      */

40     Jump next;
41
42     /**
43      * The stack map. This tells how many objects are on stack at
44      * begin of the flow block, and to what locals they are maped.
45      * @see FlowBlock.mapStackToLocal
46      */

47     VariableStack stackMap;
48
49     public Jump (FlowBlock dest) {
50         this.destination = dest;
51     }
52
53     public Jump (Jump jump) {
54     destination = jump.destination;
55     next = jump.next;
56     jump.next = this;
57     }
58
59     /**
60      * Print the source code for this structured block. This handles
61      * everything that is unique for all structured blocks and calls
62      * dumpInstruction afterwards.
63      * @param writer The tabbed print writer, where we print to.
64      */

65     public void dumpSource(jode.decompiler.TabbedPrintWriter writer)
66         throws java.io.IOException JavaDoc
67     {
68         if (destination == null)
69             writer.println ("GOTO null-ptr!!!!!");
70         else
71             writer.println("GOTO "+destination.getLabel());
72     }
73 }
74
75
Popular Tags