
package com.asakusafw.utils.java.internal.model.syntax;

import com.asakusafw.utils.java.model.syntax.BreakStatement;
import com.asakusafw.utils.java.model.syntax.ModelKind;
import com.asakusafw.utils.java.model.syntax.SimpleName;
import com.asakusafw.utils.java.model.syntax.Visitor;

/**
 * An implementation of {@link BreakStatement}.
 */
public final class BreakStatementImpl extends ModelRoot implements BreakStatement {

    private SimpleName target;

    @Override
    public SimpleName getTarget() {
        return this.target;
    }

    /**
     * Sets the target label.
     * @param target the target label, or {@code null} if there is no target labels
     */
    public void setTarget(SimpleName target) {
        this.target = target;
    }

    /**
     * Returns {@link ModelKind#BREAK_STATEMENT} which represents this element kind.
     * @return {@link ModelKind#BREAK_STATEMENT}
     */
    @Override
    public ModelKind getModelKind() {
        return ModelKind.BREAK_STATEMENT;
    }

    @Override
    public <R, C, E extends Throwable> R accept(Visitor<R, C, E> visitor, C context) throws E {
        Util.notNull(visitor, "visitor"); //$NON-NLS-1$
        return visitor.visitBreakStatement(this, context);
    }
}
