summaryrefslogtreecommitdiff
path: root/src/fjbg/ch/epfl/lamp/fjbg/JLabel.java
blob: 5b7c0f9ba7c90d7c00d3c37a96b651ef19b04770 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/* FJBG -- Fast Java Bytecode Generator
 * Copyright 2002-2012 LAMP/EPFL
 * @author  Michel Schinz
 */

package ch.epfl.lamp.fjbg;

/**
 * Labels which can be attached to instructions.
 *
 * @author Michel Schinz
 * @version 1.0
 */

public class JLabel {
    public final static int UNDEFINED_ANCHOR = -1;
    protected int anchor = UNDEFINED_ANCHOR;

    public boolean isAnchored() { return anchor != UNDEFINED_ANCHOR; }

    public int getAnchor() {
        assert isAnchored();
        return anchor;
    }

    public void setAnchor(int anchor) {
        assert !isAnchored();
        this.anchor = anchor;
    }
}