public class AtomicMaxLong extends Object
Modifier and Type | Field and Description |
---|---|
protected Object |
updateLock |
protected long |
value |
Constructor and Description |
---|
AtomicMaxLong()
Constructs an instance to store the maximum value.
创建一个实例,用来保存最大值。 |
Modifier and Type | Method and Description |
---|---|
long |
get()
getCurrent value.
获得当前值。 |
long |
getAndMax(long newValue)
Compare a value with current maximum value and make the greater one the new maximum value;
Previous maximum value before comparison is returned.
拿一个值同当前值比较,把其中大的那个设置为新的最大值,返回比较之前的老的最大值。 |
int |
intValue()
getCurrent value as int.
以int类型获得当前值。 |
long |
longValue()
getCurrent value.
获得当前值。 |
void |
max(long newValue)
Compare a value with current maximum value and make the greater one the new maximum value.
拿一个值同当前值比较,把其中大的那个设置为新的最大值。 |
long |
maxAndGet(long newValue)
Compare a value with current maximum value and make the greater one the new maximum value;
New maximum value after comparison is returned.
拿一个值同当前值比较,把其中大的那个设置为新的最大值,返回比较之后的新的最大值。 |
void |
reset()
Reset to initial status.
回复到初始状态。 |
String |
toString() |
protected long value
protected Object updateLock
public AtomicMaxLong()
public long maxAndGet(long newValue)
newValue
- 拿来作比较的值。public long getAndMax(long newValue)
newValue
- 拿来作比较的值。public void max(long newValue)
newValue
- 拿来作比较的值。public void reset()
public long get()
public long longValue()
public int intValue()
Copyright © 2014. All Rights Reserved.