Package edu.stanford.nlp.sempre

Source Code of edu.stanford.nlp.sempre.BooleanValue

package edu.stanford.nlp.sempre;

import fig.basic.LispTree;

/**
* Represents a boolean.
* @author Percy Liang
**/
public class BooleanValue extends Value {
  public final boolean value;

  public BooleanValue(boolean value) { this.value = value; }
  public BooleanValue(LispTree tree) { this.value = Boolean.parseBoolean(tree.child(1).value); }

  public LispTree toLispTree() {
    LispTree tree = LispTree.proto.newList();
    tree.addChild("boolean");
    tree.addChild(value+"");
    return tree;
  }

  @Override public int hashCode() { return Boolean.valueOf(value).hashCode(); }
  @Override public boolean equals(Object thatObj) {
    if (!(thatObj instanceof BooleanValue)) return false;
    BooleanValue that = (BooleanValue)thatObj;
    return this.value == that.value;
  }
}
TOP

Related Classes of edu.stanford.nlp.sempre.BooleanValue

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.