Standard code formatting

This commit is contained in:
Peter Lawrey
2018-04-21 10:49:49 +01:00
parent c7efd950f8
commit 9323cf28a7
270 changed files with 2801 additions and 2551 deletions
@@ -25,14 +25,14 @@ import org.jetbrains.annotations.NotNull;
* SPI interface for customizing "low-level" modification operations on {@link ChronicleMap}
* entries. All {@code ChronicleMap} modifications operate via an instance of this interface:
* <ul>
* <li>Ordinary query operations: {@code map.put()}, {@code map.compute()}, {@code map.remove()}
* </li>
* <li>Operations with entry during iterations on the map, or the key/value/entry views,
* like {@code iterator.remove()}.</li>
* <li>Remote map operation calls and Replicated {@code ChronicleMap} reconciliation operations:
* see {@link MapRemoteOperations}.</li>
* <li>Ordinary query operations: {@code map.put()}, {@code map.compute()}, {@code map.remove()}
* </li>
* <li>Operations with entry during iterations on the map, or the key/value/entry views,
* like {@code iterator.remove()}.</li>
* <li>Remote map operation calls and Replicated {@code ChronicleMap} reconciliation operations:
* see {@link MapRemoteOperations}.</li>
* </ul>
*
* <p>
* <p>By default {@link #remove}, {@link #insert} and {@link #replaceValue} return {@code null},
* but subclasses could return something more sensible, to be used in higher-level SPI interfaces,
* namely {@link MapMethods} and {@link MapRemoteOperations}. For example, in bidirectional map
@@ -41,15 +41,15 @@ import org.jetbrains.annotations.NotNull;
* type could be used to indicate if we were successful to lock both maps before performing
* the update: <pre><code>
* enum DualLockSuccess {SUCCESS, FAIL}
*
* <p>
* class{@code BiMapEntryOperations<K, V>}
* implements{@code MapEntryOperations<K, V, DualLockSuccess>} {
* {@code ChronicleMap<V, K>} reverse;
*
* <p>
* public void{@code setReverse(ChronicleMap<V, K>} reverse) {
* this.reverse = reverse;
* }
*
* <p>
* {@literal @}Override
* public DualLockSuccess{@literal remove(@}NotNull{@code MapEntry<K, V>} entry) {
* try{@code (ExternalMapQueryContext<V, K, ?>} rq = reverse.queryContext(entry.value())) {
@@ -70,10 +70,10 @@ import org.jetbrains.annotations.NotNull;
* }
* }
* }
*
* <p>
* // ... other methods
* }
*
* <p>
* class{@code BiMapMethods<K, V>} implements{@code MapMethods<K, V, DualLockSuccess>} {
* {@literal @}Override
* public void{@code remove(MapQueryContext<K, V, DualLockSuccess>} q,
@@ -92,48 +92,46 @@ import org.jetbrains.annotations.NotNull;
* }
* }
* }
*
* <p>
* // ... other methods
* }</code></pre>
*
* @param <K> the map key type
* @param <V> the map value type
* @param <R> methods return type, used for communication between lower- and higher-level SPI
* @see ChronicleMapBuilder#entryOperations(MapEntryOperations)
* @see ChronicleMapBuilder#entryOperations(MapEntryOperations)
*/
public interface MapEntryOperations<K, V, R> {
/**
* Removes the given entry from the map.
*
* @implNote default implementation calls {@link MapEntry#doRemove()} on the given entry
* and returns {@code null}.
*
* @param entry the entry to remove
* @return result of operation, understandable by higher-level SPIs, e. g. custom
* {@link MapMethods} implementation
* @throws IllegalStateException if some locking/state conditions required to perform remove
* operation are not met
* @throws RuntimeException if removal was unconditionally unsuccessful due to any reason
* operation are not met
* @throws RuntimeException if removal was unconditionally unsuccessful due to any reason
* @implNote default implementation calls {@link MapEntry#doRemove()} on the given entry
* and returns {@code null}.
*/
default R remove(@NotNull MapEntry<K, V> entry) {
entry.doRemove();
return null;
}
/**
* Replaces the given entry's value with the new one.
*
* @implNote default implementation calls {@link MapEntry#doReplaceValue(Data)
* entry.doReplaceValue(newValue)} and returns {@code null}.
*
* @param entry the entry to replace the value in
* @return result of operation, understandable by higher-level SPIs, e. g. custom
* {@link MapMethods} implementation
* @throws IllegalStateException if some locking/state conditions required to perform replace
* operation are not met
* @throws RuntimeException if value replacement was unconditionally unsuccessful due
* to any reason
* operation are not met
* @throws RuntimeException if value replacement was unconditionally unsuccessful due
* to any reason
* @implNote default implementation calls {@link MapEntry#doReplaceValue(Data)
* entry.doReplaceValue(newValue)} and returns {@code null}.
*/
default R replaceValue(@NotNull MapEntry<K, V> entry, Data<V> newValue) {
entry.doReplaceValue(newValue);
@@ -144,14 +142,13 @@ public interface MapEntryOperations<K, V, R> {
* Inserts the new entry into the map, of {@link MapAbsentEntry#absentKey() the key} from
* the given insertion context (<code>absentEntry</code>) and the given {@code value}.
*
* @implNote default implementation calls {@link MapAbsentEntry#doInsert(Data)
* absentEntry.doInsert(value)} and returns {@code null}.
*
* @return result of operation, understandable by higher-level SPIs, e. g. custom
* {@link MapMethods} implementation
* @throws IllegalStateException if some locking/state conditions required to perform insertion
* operation are not met
* @throws RuntimeException if insertion was unconditionally unsuccessful due to any reason
* operation are not met
* @throws RuntimeException if insertion was unconditionally unsuccessful due to any reason
* @implNote default implementation calls {@link MapAbsentEntry#doInsert(Data)
* absentEntry.doInsert(value)} and returns {@code null}.
*/
default R insert(@NotNull MapAbsentEntry<K, V> absentEntry, Data<V> value) {
absentEntry.doInsert(value);