/* Generated by JTB 1.5.1 */
package grammars.fm.syntaxtree;

import grammars.fm.visitor.IVis2Visitor;
import grammars.fm.visitor.IVoidVisitor;

@SuppressWarnings("javadoc")
public class NodeOptional implements INode {

  public INode node;

  private static final long serialVersionUID = 151L;

  public NodeOptional() {
    node = null;
  }

  public NodeOptional(final INode n) {
    addNode(n);
  }

  public void addNode(final INode n) {
    if (node != null)
      throw new Error("Attempt to set optional node twice"); //$NON-NLS-1$
    node = n;
  }

  public boolean present() {
    return (node != null); }

  /*
   * Visitors accept methods (no -novis option, visitors specification : Void,void,None;Vis2,int,java.lang.String)
   */

  @Override
  public int accept(final IVis2Visitor vis, final String argu) {
    return vis.visit(this, argu);
  }

  @Override
  public void accept(final IVoidVisitor vis) {
    vis.visit(this);
  }

}
