Add javadocs to SegmentContexts

This commit is contained in:
leventov
2015-07-25 15:16:13 +03:00
parent 340ab09409
commit 3228f3e59b
4 changed files with 47 additions and 3 deletions
@@ -33,7 +33,7 @@ import java.util.function.Predicate;
* This interface defines common {@link ChronicleMap} and {@link ChronicleSet}, related to off-heap
* memory management and file-mapping. Not usable by itself.
*/
public interface ChronicleHash<K, C extends HashEntry<K>, SC extends HashSegmentContext<K, ?>,
public interface ChronicleHash<K, E extends HashEntry<K>, SC extends HashSegmentContext<K, ?>,
EQC extends ExternalHashQueryContext<K>> extends Closeable {
/**
* Returns the file this hash container mapped to, i. e. when it is created by
@@ -99,7 +99,7 @@ public interface ChronicleHash<K, C extends HashEntry<K>, SC extends HashSegment
* @return {@code true} if the predicate returned {@code true} for all entries of
* the {@code ChronicleHash}, {@code false} if it returned {@code false} for the entry
*/
boolean forEachEntryWhile(Predicate<? super C> predicate);
boolean forEachEntryWhile(Predicate<? super E> predicate);
/**
* Performs the given action for each entry in this {@code ChronicleHash} until all entries have
@@ -112,7 +112,7 @@ public interface ChronicleHash<K, C extends HashEntry<K>, SC extends HashSegment
*
* @param action the action to be performed for each entry
*/
void forEachEntry(Consumer<? super C> action); // TODO add substitution and deprecate this
void forEachEntry(Consumer<? super E> action);
/**
* Releases the off-heap memory, used by this hash container and resources, used by replication,
@@ -23,11 +23,40 @@ import net.openhft.chronicle.core.io.Closeable;
import java.util.function.Consumer;
import java.util.function.Predicate;
/**
* Context of {@link ChronicleHash}'s segment.
*
* @param <K> the key type of accessed {@code ChronicleHash}
* @param <E> the entry type
* @see ChronicleHash#segmentContext(int)
*/
public interface HashSegmentContext<K, E extends HashEntry<K>> extends HashContext<K>, Closeable {
/**
* Performs the given action for each entry in this segment until all entries have
* been processed or the action throws an {@code Exception}. Exceptions thrown by the action are
* relayed to the caller.
*
* @param action the action to be performed for each entry in this segment
*/
void forEachSegmentEntry(Consumer<? super E> action);
/**
* Checks the given predicate on each entry in this segment until all entries
* have been processed or the predicate returns {@code false} for some entry, or throws
* an {@code Exception}. Exceptions thrown by the predicate are relayed to the caller.
*
* <p>If this segment is empty (i. e. {@link #size()} call returns 0), this method returns
* {@code true} immediately.
*
* @param predicate the predicate to be checked for each entry in this segment
* @return {@code true} if the predicate returned {@code true} for all checked entries,
* {@code false} if it returned {@code false} for some entry
*/
boolean forEachSegmentEntryWhile(Predicate<? super E> predicate);
/**
* Returns the number of entries in this segment.
*/
long size();
}
@@ -20,6 +20,14 @@ package net.openhft.chronicle.map;
import net.openhft.chronicle.hash.HashSegmentContext;
/**
* Context of {@link ChronicleMap}'s segment.
*
* @param <K> the key type of accessed {@code ChronicleMap}
* @param <V> the value type of accessed {@code ChronicleMap}
* @param <R> the return type of {@link MapEntryOperations} specified for the queried map
* @see ChronicleMap#segmentContext(int)
*/
public interface MapSegmentContext<K, V, R>
extends HashSegmentContext<K, MapEntry<K, V>>, MapContext<K, V, R> {
}
@@ -20,6 +20,13 @@ package net.openhft.chronicle.set;
import net.openhft.chronicle.hash.HashSegmentContext;
/**
* Context of {@link ChronicleSet}'s segment.
*
* @param <K> the key type of accessed {@code ChronicleSet}
* @param <R> the return type of {@link SetEntryOperations} specified for the queried set
* @see ChronicleSet#segmentContext(int)
*/
public interface SetSegmentContext<K, R>
extends HashSegmentContext<K, SetEntry<K>>, SetContext<K, R> {
}