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