Introduction to this package.
| Modifier and Type | Field and Description |
|---|---|
| protected long |
| Access | Constructor and Description |
|---|---|
| public | SynchronizedLong(long initialValue)
Make a new SynchronizedLong with the given initial value, and using its own internal lock. |
| public | SynchronizedLong(long initialValue, Object lock)
Make a new SynchronizedLong with the given initial value, and using the supplied lock. |
| Modifier and Type | Method and Description |
|---|---|
| public long | |
| public long | |
| public boolean | Returns: true if successfulSet value to newValue only if it is currently assumedValue. |
| public int | compareTo(long
the object to be compared. other)Implements java. |
| public int | compareTo(SynchronizedLong
the object to be compared. other)Implements java. |
| public int | compareTo(Object
the object to be compared. other)Implements java. |
| public long | |
| public long | |
| public long | |
| public boolean | equals(Object
the reference object with which to compare. other)Overrides java. |
| public final long | |
| public int | |
| public long | |
| public long | |
| public long | |
| public long | |
| public long | |
| public long | |
| public long | Returns: the new valueAtomically swap values with another SynchronizedLong. |
| public String | |
| public long |
| value_ | back to summary |
|---|---|
| protected long value_ | |
| SynchronizedLong | back to summary |
|---|---|
| public SynchronizedLong(long initialValue) Make a new SynchronizedLong with the given initial value, and using its own internal lock. | |
| SynchronizedLong | back to summary |
|---|---|
| public SynchronizedLong(long initialValue, Object lock) Make a new SynchronizedLong with the given initial value, and using the supplied lock. | |
| add | back to summary |
|---|---|
| public long add(long amount) Add amount to value (i.e., set value += amount)
| |
| and | back to summary |
|---|---|
| public long and(long b) Set value to value & b.
| |
| commit | back to summary |
|---|---|
| public boolean commit(long assumedValue, long newValue) Set value to newValue only if it is currently assumedValue.
| |
| compareTo | back to summary |
|---|---|
| public int compareTo(long other) Implements java. Doc from java. Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object. The implementor must ensure The implementor must also ensure that the relation is transitive:
Finally, the implementor must ensure that
| |
| compareTo | back to summary |
|---|---|
| public int compareTo(SynchronizedLong other) Implements java. Doc from java. Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object. The implementor must ensure The implementor must also ensure that the relation is transitive:
Finally, the implementor must ensure that
| |
| compareTo | back to summary |
|---|---|
| public int compareTo(Object other) Implements java. Doc from java. Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object. The implementor must ensure The implementor must also ensure that the relation is transitive:
Finally, the implementor must ensure that
| |
| complement | back to summary |
|---|---|
| public long complement() Set the value to its complement
| |
| decrement | back to summary |
|---|---|
| public long decrement() Decrement the value.
| |
| divide | back to summary |
|---|---|
| public long divide(long factor) Divide value by factor (i.e., set value /= factor)
| |
| equals | back to summary |
|---|---|
| public boolean equals(Object other) Overrides java. Doc from java. Indicates whether some other object is "equal to" this one.
The
An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.
| |
| get | back to summary |
|---|---|
| public final long get() Return the current value | |
| hashCode | back to summary |
|---|---|
| public int hashCode() Overrides java. Doc from java. Returns a hash code value for the object. This method is
supported for the benefit of hash tables such as those provided by
The general contract of
| |
| increment | back to summary |
|---|---|
| public long increment() Increment the value.
| |
| multiply | back to summary |
|---|---|
| public long multiply(long factor) Multiply value by factor (i.e., set value *= factor)
| |
| negate | back to summary |
|---|---|
| public long negate() Set the value to the negative of its old value
| |
| or | back to summary |
|---|---|
| public long or(long b) Set value to value | b.
| |
| set | back to summary |
|---|---|
| public long set(long newValue) Set to newValue.
| |
| subtract | back to summary |
|---|---|
| public long subtract(long amount) Subtract amount from value (i.e., set value -= amount)
| |
| swap | back to summary |
|---|---|
| public long swap(SynchronizedLong other) Atomically swap values with another SynchronizedLong. Uses identityHashCode to avoid deadlock when two SynchronizedLongs attempt to simultaneously swap with each other.
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object.
| |
| xor | back to summary |
|---|---|
| public long xor(long b) Set value to value ^ b.
| |