cb.petal.FloatLiteral Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of org.crazybeans Show documentation
Show all versions of org.crazybeans Show documentation
Java library to read, modify or create Rational Rose petal files
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;
import java.text.NumberFormat;
import java.util.*;
/**
* Floating point literal (in fact a double).
*
* @version $Id: FloatLiteral.java,v 1.10 2001/07/09 07:48:52 dahm Exp $
* @author M. Dahm
*/
public class FloatLiteral extends Literal {
static final long serialVersionUID=1505488095051523558L;
private double value;
private static NumberFormat format;
static {
format = NumberFormat.getInstance(Locale.ENGLISH);
format.setMaximumFractionDigits(6);
format.setMinimumFractionDigits(6);
}
public FloatLiteral(double value) {
super("");
this.value = value;
}
public double getValue() { return value; }
public void setValue(double d) { value = d; }
public java.lang.Object getLiteralValue() {
return new Float(value);
}
public String toString() {
return format.format(value);
}
public void accept(Visitor v) {
v.visit(this);
}
public boolean equals(java.lang.Object o) {
return (o instanceof FloatLiteral) && (((FloatLiteral)o).value == this.value);
}
}