me.ruebner.jvisualizer.backend.vm.values.DoubleValue Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jvisualizer Show documentation
Show all versions of jvisualizer Show documentation
This project aims to provide an easy tool to visualize data flow and objects within the JVM. It is intended for
students that are starting to learn programming with Java.
The newest version!
package me.ruebner.jvisualizer.backend.vm.values;
import com.fasterxml.jackson.annotation.JsonProperty;
import me.ruebner.jvisualizer.backend.vm.types.DoubleType;
/**
* Represents a primitive double value.
*/
public class DoubleValue extends PrimitiveValue {
/**
* the actual double value
*/
private final double value;
/**
* Creates a new double value object. To create a new double value object based on a
* {@link com.sun.jdi.DoubleValue} object, use {@link #fromJdi(com.sun.jdi.DoubleValue)}.
*
* @param value the actual double value
*/
private DoubleValue(double value) {
super(DoubleType.create());
this.value = value;
}
/**
* Creates a new double value object based on a {@link com.sun.jdi.DoubleValue} object.
*
* @param jdiDoubleValue the JDI double value object
* @return a new double value object based on {@code jdiDoubleValue}
*/
public static DoubleValue fromJdi(com.sun.jdi.DoubleValue jdiDoubleValue) {
return new DoubleValue(jdiDoubleValue.value());
}
/**
* Retrieves the actual double value.
*
* @return the actual double value
*/
@JsonProperty
public double getValue() {
return value;
}
@Override
public String toString() {
return Double.toString(value);
}
}