package formulaVisited;


/**
  A logical constant, representing true or false.
*/
public class LogicalConstant implements Formula {

  static private LogicalConstant one = new LogicalConstant(true);
  /**
    Returns a logical constant for 1 (true).
    The same constant is returned for every call.
    The constant is constructed at initialization time
    (eager initialization).
  */
  static public  LogicalConstant one() {  return one;  }

  static private LogicalConstant zero = null;
  /**
    Returns a logical constant for 0 (false).
    The same constant is returned for every call.
    The constant is not constructed until the first call
    (lazy initialization).
  */
  static public  LogicalConstant zero() {
    if (null == zero) {
      zero = new LogicalConstant(false);
    }
    return zero;
  }

  boolean value;
  /**
    Constructs a logical constant.
    @param _value The constant's value.
  */
  private LogicalConstant(boolean _value) {  value = _value;  }

  public Object accept(Visitor _v) {  return _v.visit(this);  }

}
