public class SynchronizedShort extends SynchronizedVariable implements java.lang.Comparable, java.lang.Cloneable
Modifier and Type | Field and Description |
---|---|
protected short |
value_ |
lock_
Constructor and Description |
---|
SynchronizedShort(short initialValue)
Make a new SynchronizedShort with the given initial value,
and using its own internal lock.
|
SynchronizedShort(short initialValue,
java.lang.Object lock)
Make a new SynchronizedShort with the given initial value,
and using the supplied lock.
|
Modifier and Type | Method and Description |
---|---|
short |
add(short amount)
Add amount to value (i.e., set value += amount)
|
short |
and(short b)
Set value to value & b.
|
boolean |
commit(short assumedValue,
short newValue)
Set value to newValue only if it is currently assumedValue.
|
int |
compareTo(java.lang.Object other) |
int |
compareTo(short other) |
int |
compareTo(SynchronizedShort other) |
short |
complement()
Set the value to its complement
|
short |
decrement()
Decrement the value.
|
short |
divide(short factor)
Divide value by factor (i.e., set value /= factor)
|
boolean |
equals(java.lang.Object other) |
short |
get()
Return the current value
|
int |
hashCode() |
short |
increment()
Increment the value.
|
short |
multiply(short factor)
Multiply value by factor (i.e., set value *= factor)
|
short |
negate()
Set the value to the negative of its old value
|
short |
or(short b)
Set value to value | b.
|
short |
set(short newValue)
Set to newValue.
|
short |
subtract(short amount)
Subtract amount from value (i.e., set value -= amount)
|
short |
swap(SynchronizedShort other)
Atomically swap values with another SynchronizedShort.
|
java.lang.String |
toString() |
short |
xor(short b)
Set value to value ^ b.
|
execute, getLock
public SynchronizedShort(short initialValue)
public SynchronizedShort(short initialValue, java.lang.Object lock)
public final short get()
public short set(short newValue)
public boolean commit(short assumedValue, short newValue)
public short swap(SynchronizedShort other)
public short increment()
public short decrement()
public short add(short amount)
public short subtract(short amount)
public short multiply(short factor)
public short divide(short factor)
public short negate()
public short complement()
public short and(short b)
public short or(short b)
public short xor(short b)
public int compareTo(short other)
public int compareTo(SynchronizedShort other)
public int compareTo(java.lang.Object other)
compareTo
in interface java.lang.Comparable
public boolean equals(java.lang.Object other)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object