Class MutableDouble

java.lang.Object
java.lang.Number
com.luna.common.mutable.MutableDouble
All Implemented Interfaces:
Mutable<Number>, Serializable, Comparable<MutableDouble>

public class MutableDouble extends Number implements Comparable<MutableDouble>, Mutable<Number>
可变 double 类型
Since:
3.0.1
See Also:
  • Constructor Details

    • MutableDouble

      public MutableDouble()
      构造,默认值0
    • MutableDouble

      public MutableDouble(double value)
      构造
      Parameters:
      value - 值
    • MutableDouble

      public MutableDouble(Number value)
      构造
      Parameters:
      value - 值
    • MutableDouble

      public MutableDouble(String value) throws NumberFormatException
      构造
      Parameters:
      value - String值
      Throws:
      NumberFormatException - 数字转换错误
  • Method Details

    • get

      public Double get()
      Description copied from interface: Mutable
      获得原始值
      Specified by:
      get in interface Mutable<Number>
      Returns:
      原始值
    • set

      public void set(double value)
      设置值
      Parameters:
      value - 值
    • set

      public void set(Number value)
      Description copied from interface: Mutable
      设置值
      Specified by:
      set in interface Mutable<Number>
      Parameters:
      value - 值
    • increment

      public MutableDouble increment()
      值+1
      Returns:
      this
    • decrement

      public MutableDouble decrement()
      值减一
      Returns:
      this
    • add

      public MutableDouble add(double operand)
      增加值
      Parameters:
      operand - 被增加的值
      Returns:
      this
    • add

      public MutableDouble add(Number operand)
      增加值
      Parameters:
      operand - 被增加的值,非空
      Returns:
      this
    • subtract

      public MutableDouble subtract(double operand)
      减去值
      Parameters:
      operand - 被减的值
      Returns:
      this
    • subtract

      public MutableDouble subtract(Number operand)
      减去值
      Parameters:
      operand - 被减的值,非空
      Returns:
      this
    • intValue

      public int intValue()
      Specified by:
      intValue in class Number
    • longValue

      public long longValue()
      Specified by:
      longValue in class Number
    • floatValue

      public float floatValue()
      Specified by:
      floatValue in class Number
    • doubleValue

      public double doubleValue()
      Specified by:
      doubleValue in class Number
    • equals

      public boolean equals(Object obj)
      相等需同时满足如下条件:
      1. 非空
      2. 类型为 MutableDouble
      3. 值相等
      Overrides:
      equals in class Object
      Parameters:
      obj - 比对的对象
      Returns:
      相同返回true,否则 false
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • compareTo

      public int compareTo(MutableDouble other)
      比较
      Specified by:
      compareTo in interface Comparable<MutableDouble>
      Parameters:
      other - 其它 MutableDouble 对象
      Returns:
      x==y返回0,x<y返回-1,x>y返回1
    • toString

      public String toString()
      Overrides:
      toString in class Object