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

com.eg.agent.android.sample.SampleValue Maven / Gradle / Ivy

There is a newer version: 2.1.3
Show newest version
package com.eg.agent.android.sample;

public class SampleValue
{
  private Double value = Double.valueOf(0.0D);
  private boolean isDouble;
  
  public SampleValue(double value)
  {
    setValue(value);
  }
  
  public SampleValue(long value)
  {
    setValue(value);
  }
  
  public Number getValue()
  {
    if (this.isDouble) {
      return asDouble();
    }
    return asLong();
  }
  
  public Double asDouble()
  {
    return this.value;
  }
  
  public Long asLong()
  {
    return Long.valueOf(this.value.longValue());
  }
  
  public void setValue(double value)
  {
    this.value = Double.valueOf(value);
    this.isDouble = true;
  }
  
  public void setValue(long value)
  {
    this.value = Double.valueOf(value);
    this.isDouble = false;
  }
  
  public boolean isDouble()
  {
    return this.isDouble;
  }
  
  public void setDouble(boolean aDouble)
  {
    this.isDouble = aDouble;
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy