001//
002// Generated by JTB 1.1.2
003//
004
005package jtb.cparser.syntaxtree;
006
007/**
008 * Represents an grammar optional node, e.g. ( A )? or [ A ]
009 */
010public class NodeOptional implements Node {
011  static final long serialVersionUID = 20050923L;
012
013   public NodeOptional() {
014      node = null;
015   }
016
017   public NodeOptional(Node n) {
018      addNode(n);
019   }
020
021   public void addNode(Node n)  {
022      if ( node != null)                // Oh oh!
023         throw new Error("Attempt to set optional node twice");
024
025      node = n;
026   }
027   public void accept(jtb.cparser.visitor.Visitor v) {
028      v.visit(this);
029   }
030   public boolean present()   { return node != null; }
031
032   public Node node;
033}
034