Label.java revision bb7937fd308738b46db61e5e6181dff3c8e6e19e
1package org.jf.dexlib2.builder;
2
3import javax.annotation.Nonnull;
4import javax.annotation.Nullable;
5
6public class Label {
7    @Nullable MethodLocation location;
8
9    Label() {
10    }
11
12    Label(MethodLocation location) {
13        this.location = location;
14    }
15
16    public int getCodeAddress() {
17        return getLocation().getCodeAddress();
18    }
19
20    @Nonnull
21    public MethodLocation getLocation() {
22        if (location == null) {
23            throw new IllegalStateException("Cannot get the location of a label that hasn't been placed yet.");
24        }
25        return location;
26    }
27
28    public boolean isPlaced() {
29        return location != null;
30    }
31}
32