summaryrefslogtreecommitdiff
path: root/src/main/java/io/devnulllabs/openjava/ptree/BreakStatement.java
blob: a7c01fbd09c15227dfba4959a84fc33939a8bb78 (plain)
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/*
 * BreakStatement.java 1.0
 *
 *
 * Jun 20, 1997 mich
 * Sep 29, 1997 bv
 * Oct 11, 1997 mich
 *
 * @see io.devnulllabs.openjava.ptree.ParseTree
 * @version 1.0 last updated:  Oct 11, 1997
 * @author  Michiaki Tatsubori
 */
package io.devnulllabs.openjava.ptree;

import io.devnulllabs.openjava.ptree.util.ParseTreeVisitor;

/**
 * The <code>BreakStatement</code> class represents
 * a break statement node of parse tree.
 *
 * @see io.devnulllabs.openjava.ptree.ParseTree
 * @see io.devnulllabs.openjava.ptree.NonLeaf
 * @see io.devnulllabs.openjava.ptree.Statement
 */
public class BreakStatement extends NonLeaf implements Statement {

    /**
     * Allocates a new BreakStatement object.
     *
     * @param  label  the label of this break statemetn.
     *                if this is null, break statement has no label.
     */
    public BreakStatement(String label) {
        super();
        set(label);
    }

    /**
     * Allocates a new BreakStatement object.
     *
     */
    public BreakStatement() {
        this(null);
    }

    /**
     * Gets the label of this break statement.
     *
     * @return  the label name.
     *          If there is no label then this method returns null.
     */
    public String getLabel() {
        return (String) elementAt(0);
    }

    /**
     * Sets the label of this break statement.
     *
     * @param  label  the label.
     */
    public void setLabel(String label) {
        setElementAt(label, 0);
    }

    public void accept(ParseTreeVisitor v) throws ParseTreeException {
        v.visit(this);
    }

}