类 MutableInt

java.lang.Object
java.lang.Number
com.luna.common.mutable.MutableInt
所有已实现的接口:
Mutable<Number>, Serializable, Comparable<MutableInt>

public class MutableInt extends Number implements Comparable<MutableInt>, Mutable<Number>
可变 int 类型
从以下版本开始:
3.0.1
另请参阅:
  • 构造器详细资料

    • MutableInt

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

      public MutableInt(int value)
      构造
      参数:
      value - 值
    • MutableInt

      public MutableInt(Number value)
      构造
      参数:
      value - 值
    • MutableInt

      public MutableInt(String value) throws NumberFormatException
      构造
      参数:
      value - String值
      抛出:
      NumberFormatException - 数字转换错误
  • 方法详细资料

    • get

      public Integer get()
      从接口复制的说明: Mutable
      获得原始值
      指定者:
      get 在接口中 Mutable<Number>
      返回:
      原始值
    • set

      public void set(int value)
      设置值
      参数:
      value - 值
    • set

      public void set(Number value)
      从接口复制的说明: Mutable
      设置值
      指定者:
      set 在接口中 Mutable<Number>
      参数:
      value - 值
    • increment

      public MutableInt increment()
      值+1
      返回:
      this
    • decrement

      public MutableInt decrement()
      值减一
      返回:
      this
    • add

      public MutableInt add(int operand)
      增加值
      参数:
      operand - 被增加的值
      返回:
      this
    • add

      public MutableInt add(Number operand)
      增加值
      参数:
      operand - 被增加的值,非空
      返回:
      this
      抛出:
      NullPointerException - if the object is null
    • subtract

      public MutableInt subtract(int operand)
      减去值
      参数:
      operand - 被减的值
      返回:
      this
    • subtract

      public MutableInt subtract(Number operand)
      减去值
      参数:
      operand - 被减的值,非空
      返回:
      this
      抛出:
      NullPointerException - if the object is null
    • intValue

      public int intValue()
      指定者:
      intValue 在类中 Number
    • longValue

      public long longValue()
      指定者:
      longValue 在类中 Number
    • floatValue

      public float floatValue()
      指定者:
      floatValue 在类中 Number
    • doubleValue

      public double doubleValue()
      指定者:
      doubleValue 在类中 Number
    • equals

      public boolean equals(Object obj)
      相等需同时满足如下条件:
      1. 非空
      2. 类型为 MutableInt
      3. 值相等
      覆盖:
      equals 在类中 Object
      参数:
      obj - 比对的对象
      返回:
      相同返回true,否则 false
    • hashCode

      public int hashCode()
      覆盖:
      hashCode 在类中 Object
    • compareTo

      public int compareTo(MutableInt other)
      比较
      指定者:
      compareTo 在接口中 Comparable<MutableInt>
      参数:
      other - 其它 MutableInt 对象
      返回:
      x==y返回0,x<y返回-1,x>y返回1
    • toString

      public String toString()
      覆盖:
      toString 在类中 Object