Package com.luna.common.mutable
Class MutableInt
java.lang.Object
java.lang.Number
com.luna.common.mutable.MutableInt
- All Implemented Interfaces:
Mutable<Number>
,Serializable
,Comparable<MutableInt>
可变
int
类型- Since:
- 3.0.1
- See Also:
-
Constructor Summary
ConstructorDescription构造,默认值0MutableInt
(int value) 构造MutableInt
(Number value) 构造MutableInt
(String value) 构造 -
Method Summary
Modifier and TypeMethodDescriptionadd
(int operand) 增加值增加值int
compareTo
(MutableInt other) 比较值减一double
boolean
相等需同时满足如下条件: 非空 类型为MutableInt
值相等float
get()
获得原始值int
hashCode()
值+1int
intValue()
long
void
set
(int value) 设置值void
设置值subtract
(int operand) 减去值减去值toString()
Methods inherited from class java.lang.Number
byteValue, shortValue
-
Constructor Details
-
MutableInt
public MutableInt()构造,默认值0 -
MutableInt
public MutableInt(int value) 构造- Parameters:
value
- 值
-
MutableInt
构造- Parameters:
value
- 值
-
MutableInt
构造- Parameters:
value
- String值- Throws:
NumberFormatException
- 数字转换错误
-
-
Method Details
-
get
Description copied from interface:Mutable
获得原始值 -
set
public void set(int value) 设置值- Parameters:
value
- 值
-
set
Description copied from interface:Mutable
设置值 -
increment
值+1- Returns:
- this
-
decrement
值减一- Returns:
- this
-
add
增加值- Parameters:
operand
- 被增加的值- Returns:
- this
-
add
增加值- Parameters:
operand
- 被增加的值,非空- Returns:
- this
- Throws:
NullPointerException
- if the object is null
-
subtract
减去值- Parameters:
operand
- 被减的值- Returns:
- this
-
subtract
减去值- Parameters:
operand
- 被减的值,非空- Returns:
- this
- Throws:
NullPointerException
- if the object is null
-
intValue
public int intValue() -
longValue
public long longValue() -
floatValue
public float floatValue()- Specified by:
floatValue
in classNumber
-
doubleValue
public double doubleValue()- Specified by:
doubleValue
in classNumber
-
equals
相等需同时满足如下条件:- 非空
- 类型为
MutableInt
- 值相等
-
hashCode
public int hashCode() -
compareTo
比较- Specified by:
compareTo
in interfaceComparable<MutableInt>
- Parameters:
other
- 其它MutableInt
对象- Returns:
- x==y返回0,x<y返回-1,x>y返回1
-
toString
-