All Downloads are FREE. Search and download functionalities are using the official Maven repository.

cb.petal.Value Maven / Gradle / Ivy

The newest version!
/**
 * Copyright (c) 2001 Markus Dahm
 * Copyright (C) 2015-2018 BITPlan GmbH http://www.bitplan.com
 *
 * This source is part of
 * https://github.com/BITPlan/CrazyBeans
 * and the license as outlined there applies
 */
package cb.petal;

/**
 * Values like in (value Text "foo")
 *
 * @version $Id: Value.java,v 1.11 2001/07/09 07:48:52 dahm Exp $
 * @author  M. Dahm
 */
public class Value extends Literal {
  static final long serialVersionUID=-1364810248783653817L;

  private String        name;
  private StringLiteral value;

  public Value(String name, StringLiteral value) {
    super("value");
    setValueName(name);
    setValue(value);
  }

  public void   setValueName(String n) { name = n.intern(); }
  public String getValueName()         { return name; }
  public void          setValue(StringLiteral v) { value = v; }
  public StringLiteral getValue()                { return value; }

  public String getStringValue() { return value.getValue(); }

  public String toString() { return "(value " + name + " " + value + ")"; }
  
  public void accept(Visitor v) {
    v.visit(this);
  }

  public java.lang.Object getLiteralValue() {
    return name + " \"" + value.getLiteralValue() + '"';
  }

  public boolean equals(java.lang.Object o) {
    return (o instanceof Value) && (((Value)o).value.equals(this.value)) &&
      (((Value)o).name.equals(this.name));
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy