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