Skip to content

Commit

Permalink
Javadoc
Browse files Browse the repository at this point in the history
  • Loading branch information
garydgregory committed Jun 23, 2024
1 parent 1182f90 commit 094521f
Show file tree
Hide file tree
Showing 14 changed files with 110 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,11 @@ public int hash(final T o) {
return o == null ? HASHCODE_NULL : o.hashCode();
}

/**
* Returns the singleton instance.
*
* @return the singleton instance.
*/
private Object readResolve() {
return INSTANCE;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,11 @@ public void execute(final E input) {
throw new FunctorException("ExceptionClosure invoked");
}

/**
* Returns the singleton instance.
*
* @return the singleton instance.
*/
private Object readResolve() {
return INSTANCE;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,11 @@ public T create() {
throw new FunctorException("ExceptionFactory invoked");
}

/**
* Returns the singleton instance.
*
* @return the singleton instance.
*/
private Object readResolve() {
return INSTANCE;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,11 @@ public boolean evaluate(final T object) {
throw new FunctorException("ExceptionPredicate invoked");
}

/**
* Returns the singleton instance.
*
* @return the singleton instance.
*/
private Object readResolve() {
return INSTANCE;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ public static <I, O> Transformer<I, O> exceptionTransformer() {
private ExceptionTransformer() {
}

/**
* Returns the singleton instance.
*
* @return the singleton instance.
*/
private Object readResolve() {
return INSTANCE;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,11 @@ public boolean evaluate(final T object) {
return false;
}

/**
* Returns the singleton instance.
*
* @return the singleton instance.
*/
private Object readResolve() {
return INSTANCE;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@ public void execute(final E input) {
// do nothing
}

/**
* Returns the singleton instance.
*
* @return the singleton instance.
*/
private Object readResolve() {
return INSTANCE;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@ public static <T> Transformer<T, T> nopTransformer() {
private NOPTransformer() {
}

/**
* Returns the singleton instance.
*
* @return the singleton instance.
*/
private Object readResolve() {
return INSTANCE;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,11 @@ public boolean evaluate(final T object) {
return object != null;
}

/**
* Returns the singleton instance.
*
* @return the singleton instance.
*/
private Object readResolve() {
return INSTANCE;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,11 @@ public boolean evaluate(final T object) {
return object == null;
}

/**
* Returns the singleton instance.
*
* @return the singleton instance.
*/
private Object readResolve() {
return INSTANCE;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ public static <T> Transformer<T, String> stringValueTransformer() {
private StringValueTransformer() {
}

/**
* Returns the singleton instance.
*
* @return the singleton instance.
*/
private Object readResolve() {
return INSTANCE;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,11 @@ public boolean evaluate(final T object) {
return true;
}

/**
* Returns the singleton instance.
*
* @return the singleton instance.
*/
private Object readResolve() {
return INSTANCE;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,24 @@ public V getValue() {
return value;
}

/**
* Sets the key.
*
* @param key The key.
* @return The previous key.
*/
protected K setKey(final K key) {
final K old = this.key;
this.key = key;
return old;
}

/**
* Sets the value.
*
* @param value The value.
* @return The previous value.
*/
protected V setValue(final V value) {
final V old = this.value;
this.value = value;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,15 @@ public class AbstractHashedMap<K, V> extends AbstractMap<K, V> implements Iterab
* @param <V> the type of the values in the map
*/
protected static class EntrySet<K, V> extends AbstractSet<Map.Entry<K, V>> {

/** The parent map */
private final AbstractHashedMap<K, V> parent;

/**
* Constructs a new instance.
*
* @param parent The parent map.
*/
protected EntrySet(final AbstractHashedMap<K, V> parent) {
this.parent = parent;
}
Expand Down Expand Up @@ -112,6 +118,7 @@ public int size() {
return parent.size();
}
}

/**
* EntrySet iterator.
*
Expand All @@ -120,6 +127,11 @@ public int size() {
*/
protected static class EntrySetIterator<K, V> extends HashIterator<K, V> implements Iterator<Map.Entry<K, V>> {

/**
* Constructs a new instance.
*
* @param parent The parent map.
*/
protected EntrySetIterator(final AbstractHashedMap<K, V> parent) {
super(parent);
}
Expand All @@ -129,24 +141,30 @@ public Map.Entry<K, V> next() {
return super.nextEntry();
}
}

/**
* HashEntry used to store the data.
* <p>
* If you subclass {@code AbstractHashedMap} but not {@code HashEntry}
* then you will not be able to access the protected fields.
* The {@code entryXxx()} methods on {@code AbstractHashedMap} exist
* to provide the necessary access.
* </p>
*
* @param <K> the type of the keys
* @param <V> the type of the values
*/
protected static class HashEntry<K, V> implements Map.Entry<K, V>, KeyValue<K, V> {

/** The next entry in the hash chain */
protected HashEntry<K, V> next;

/** The hash code of the key */
protected int hashCode;

/** The key */
protected Object key;

/** The value */
protected Object value;

Expand Down Expand Up @@ -206,7 +224,7 @@ public String toString() {
}
}
/**
* Base Iterator
* Base Iterator.
*
* @param <K> the type of the keys in the map
* @param <V> the type of the values in the map
Expand All @@ -215,12 +233,16 @@ protected abstract static class HashIterator<K, V> {

/** The parent map */
private final AbstractHashedMap<K, V> parent;

/** The current index into the array of buckets */
private int hashIndex;

/** The last returned entry */
private HashEntry<K, V> last;

/** The next entry */
private HashEntry<K, V> next;

/** The modification count expected */
private int expectedModCount;

Expand Down Expand Up @@ -285,6 +307,7 @@ public String toString() {
return "Iterator[]";
}
}

/**
* MapIterator implementation.
*
Expand Down Expand Up @@ -329,6 +352,7 @@ public V setValue(final V value) {
return current.setValue(value);
}
}

/**
* KeySet implementation.
*
Expand Down Expand Up @@ -387,6 +411,7 @@ public K next() {
return super.nextEntry().getKey();
}
}

/**
* Values implementation.
*
Expand Down Expand Up @@ -420,6 +445,7 @@ public int size() {
return parent.size();
}
}

/**
* Values iterator.
*
Expand All @@ -438,11 +464,22 @@ public V next() {
}
}

/** Exception message. */
protected static final String NO_NEXT_ENTRY = "No next() entry in the iteration";

/** Exception message. */
protected static final String NO_PREVIOUS_ENTRY = "No previous() entry in the iteration";

/** Exception message. */
protected static final String REMOVE_INVALID = "remove() can only be called once after next()";

/** Exception message. */
protected static final String GETKEY_INVALID = "getKey() can only be called after next() and before remove()";

/** Exception message. */
protected static final String GETVALUE_INVALID = "getValue() can only be called after next() and before remove()";

/** Exception message. */
protected static final String SETVALUE_INVALID = "setValue() can only be called after next() and before remove()";

/** The default capacity to use */
Expand Down

0 comments on commit 094521f

Please sign in to comment.