aa
com.cliffc.aa.util.NonBlockingHashMap< TypeK, TypeV >.SnapshotV Class Reference
Inheritance diagram for com.cliffc.aa.util.NonBlockingHashMap< TypeK, TypeV >.SnapshotV:
[legend]
Collaboration diagram for com.cliffc.aa.util.NonBlockingHashMap< TypeK, TypeV >.SnapshotV:
[legend]

Public Member Functions

 SnapshotV ()
 
boolean hasMoreElements ()
 
boolean hasNext ()
 
TypeV next ()
 
TypeV nextElement ()
 
void remove ()
 

Package Functions

Object key (int idx)
 
int length ()
 
Object val (int idx)
 

Package Attributes

Object _prevK
 
TypeV _prevV
 
final Object[] _sskvs
 

Private Attributes

int _idx
 
Object _nextK
 
TypeV _nextV
 

Detailed Description

Definition at line 1180 of file NonBlockingHashMap.java.

Constructor & Destructor Documentation

◆ SnapshotV()

com.cliffc.aa.util.NonBlockingHashMap< TypeK, TypeV >.SnapshotV.SnapshotV ( )

Definition at line 1182 of file NonBlockingHashMap.java.

1182  {
1183  while( true ) { // Verify no table-copy-in-progress
1184  Object[] topkvs = _kvs;
1185  CHM topchm = chm(topkvs);
1186  if( topchm._newkvs == null ) { // No table-copy-in-progress
1187  // The "linearization point" for the iteration. Every key in this
1188  // table will be visited, but keys added later might be skipped or
1189  // even be added to a following table (also not iterated over).
1190  _sskvs = topkvs;
1191  break;
1192  }
1193  // Table copy in-progress - so we cannot get a clean iteration. We
1194  // must help finish the table copy before we can start iterating.
1195  topchm.help_copy_impl(NonBlockingHashMap.this,topkvs,true);
1196  }
1197  // Warm-up the iterator
1198  next();
1199  }

References com.cliffc.aa.util.NonBlockingHashMap< TypeK, TypeV >._kvs, com.cliffc.aa.util.NonBlockingHashMap< TypeK, TypeV >.CHM< TypeK, TypeV >._newkvs, com.cliffc.aa.util.NonBlockingHashMap< TypeK, TypeV >.SnapshotV._sskvs, com.cliffc.aa.util.NonBlockingHashMap< TypeK, TypeV >.chm(), com.cliffc.aa.util.NonBlockingHashMap< TypeK, TypeV >.CHM< TypeK, TypeV >.help_copy_impl(), and com.cliffc.aa.util.NonBlockingHashMap< TypeK, TypeV >.SnapshotV.next().

Here is the call graph for this function:

Member Function Documentation

◆ hasMoreElements()

boolean com.cliffc.aa.util.NonBlockingHashMap< TypeK, TypeV >.SnapshotV.hasMoreElements ( )

Definition at line 1241 of file NonBlockingHashMap.java.

1241 { return hasNext(); }

References com.cliffc.aa.util.NonBlockingHashMap< TypeK, TypeV >.SnapshotV.hasNext().

Here is the call graph for this function:

◆ hasNext()

boolean com.cliffc.aa.util.NonBlockingHashMap< TypeK, TypeV >.SnapshotV.hasNext ( )

Definition at line 1206 of file NonBlockingHashMap.java.

1206 { return _nextV != null; }

References com.cliffc.aa.util.NonBlockingHashMap< TypeK, TypeV >.SnapshotV._nextV.

Referenced by com.cliffc.aa.util.NonBlockingHashMap< TypeK, TypeV >.SnapshotV.hasMoreElements(), com.cliffc.aa.util.NonBlockingHashMap< TypeK, TypeV >.SnapshotK.hasNext(), and com.cliffc.aa.util.NonBlockingHashMap< TypeK, TypeV >.SnapshotE.hasNext().

Here is the caller graph for this function:

◆ key()

Object com.cliffc.aa.util.NonBlockingHashMap< TypeK, TypeV >.SnapshotV.key ( int  idx)
package

Definition at line 1201 of file NonBlockingHashMap.java.

1201 { return NonBlockingHashMap.key(_sskvs,idx); }

References com.cliffc.aa.util.NonBlockingHashMap< TypeK, TypeV >.SnapshotV._sskvs, and com.cliffc.aa.util.NonBlockingHashMap< TypeK, TypeV >.key().

Referenced by com.cliffc.aa.util.NonBlockingHashMap< TypeK, TypeV >.SnapshotV.next().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ length()

int com.cliffc.aa.util.NonBlockingHashMap< TypeK, TypeV >.SnapshotV.length ( )
package

Definition at line 1200 of file NonBlockingHashMap.java.

1200 { return len(_sskvs); }

References com.cliffc.aa.util.NonBlockingHashMap< TypeK, TypeV >.SnapshotV._sskvs, and com.cliffc.aa.util.NonBlockingHashMap< TypeK, TypeV >.len().

Referenced by com.cliffc.aa.util.NonBlockingHashMap< TypeK, TypeV >.SnapshotV.next().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ next()

TypeV com.cliffc.aa.util.NonBlockingHashMap< TypeK, TypeV >.SnapshotV.next ( )

Definition at line 1208 of file NonBlockingHashMap.java.

1208  {
1209  // 'next' actually knows what the next value will be - it had to
1210  // figure that out last go-around lest 'hasNext' report true and
1211  // some other thread deleted the last value. Instead, 'next'
1212  // spends all its effort finding the key that comes after the
1213  // 'next' key.
1214  if( _idx != 0 && _nextV == null ) throw new NoSuchElementException();
1215  _prevK = _nextK; // This will become the previous key
1216  _prevV = _nextV; // This will become the previous value
1217  _nextV = null; // We have no more next-key
1218  Object nV;
1219  // Attempt to set <_nextK,_nextV> to the next K,V pair.
1220  // _nextV is the trigger: stop searching when it is != null
1221  while( _idx<length() ) { // Scan array
1222  _nextK = key(_idx++); // Get a key that definitely is in the set (for the moment!)
1223  if( _nextK != null && // Found something?
1224  _nextK != TOMBSTONE && // Key is not TOMBSTONE
1225  // Keys can be deleted and not TOMBSTONE, and after deletion had
1226  // their innards gutted... so you cannot use them to compute their
1227  // own hash or 'get' a Value. So get the paired Value directly.
1228  (nV=val(_idx-1)) != null && // Get value
1229  nV != TOMBSTONE ) // Value is not TOMBSTONE
1230  { _nextV = (TypeV)nV; break; } // Got it! _nextK/_nextV is a valid Key/Value
1231  } // Else keep scanning
1232  return _prevV; // Return current value.
1233  }

References com.cliffc.aa.util.NonBlockingHashMap< TypeK, TypeV >.SnapshotV._idx, com.cliffc.aa.util.NonBlockingHashMap< TypeK, TypeV >.SnapshotV._nextK, com.cliffc.aa.util.NonBlockingHashMap< TypeK, TypeV >.SnapshotV._nextV, com.cliffc.aa.util.NonBlockingHashMap< TypeK, TypeV >.SnapshotV._prevK, com.cliffc.aa.util.NonBlockingHashMap< TypeK, TypeV >.SnapshotV._prevV, com.cliffc.aa.util.NonBlockingHashMap< TypeK, TypeV >.SnapshotV.key(), com.cliffc.aa.util.NonBlockingHashMap< TypeK, TypeV >.SnapshotV.length(), com.cliffc.aa.util.NonBlockingHashMap< TypeK, TypeV >.TOMBSTONE, and com.cliffc.aa.util.NonBlockingHashMap< TypeK, TypeV >.SnapshotV.val().

Referenced by com.cliffc.aa.util.NonBlockingHashMap< TypeK, TypeV >.SnapshotK.next(), com.cliffc.aa.util.NonBlockingHashMap< TypeK, TypeV >.SnapshotE.next(), com.cliffc.aa.util.NonBlockingHashMap< TypeK, TypeV >.SnapshotV.nextElement(), and com.cliffc.aa.util.NonBlockingHashMap< TypeK, TypeV >.SnapshotV.SnapshotV().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ nextElement()

TypeV com.cliffc.aa.util.NonBlockingHashMap< TypeK, TypeV >.SnapshotV.nextElement ( )

Definition at line 1240 of file NonBlockingHashMap.java.

1240 { return next(); }

References com.cliffc.aa.util.NonBlockingHashMap< TypeK, TypeV >.SnapshotV.next().

Here is the call graph for this function:

◆ remove()

void com.cliffc.aa.util.NonBlockingHashMap< TypeK, TypeV >.SnapshotV.remove ( )

Definition at line 1234 of file NonBlockingHashMap.java.

1234  {
1235  if( _prevV == null ) throw new IllegalStateException();
1237  _prevV = null;
1238  }

References com.cliffc.aa.util.NonBlockingHashMap< TypeK, TypeV >.SnapshotV._prevK, com.cliffc.aa.util.NonBlockingHashMap< TypeK, TypeV >.SnapshotV._prevV, com.cliffc.aa.util.NonBlockingHashMap< TypeK, TypeV >.SnapshotV._sskvs, com.cliffc.aa.util.NonBlockingHashMap< TypeK, TypeV >.putIfMatch(), and com.cliffc.aa.util.NonBlockingHashMap< TypeK, TypeV >.TOMBSTONE.

Referenced by com.cliffc.aa.util.NonBlockingHashMap< TypeK, TypeV >.SnapshotK.remove(), and com.cliffc.aa.util.NonBlockingHashMap< TypeK, TypeV >.SnapshotE.remove().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ val()

Object com.cliffc.aa.util.NonBlockingHashMap< TypeK, TypeV >.SnapshotV.val ( int  idx)
package

Definition at line 1202 of file NonBlockingHashMap.java.

1202 { return NonBlockingHashMap.val(_sskvs,idx); }

References com.cliffc.aa.util.NonBlockingHashMap< TypeK, TypeV >.SnapshotV._sskvs, and com.cliffc.aa.util.NonBlockingHashMap< TypeK, TypeV >.val().

Referenced by com.cliffc.aa.util.NonBlockingHashMap< TypeK, TypeV >.SnapshotV.next().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ _idx

int com.cliffc.aa.util.NonBlockingHashMap< TypeK, TypeV >.SnapshotV._idx
private

◆ _nextK

Object com.cliffc.aa.util.NonBlockingHashMap< TypeK, TypeV >.SnapshotV._nextK
private

◆ _nextV

◆ _prevK

◆ _prevV

◆ _sskvs


The documentation for this class was generated from the following file:
com.cliffc.aa.util.NonBlockingHashMap.SnapshotV._sskvs
final Object[] _sskvs
Definition: NonBlockingHashMap.java:1181
com.cliffc.aa.util.NonBlockingHashMap.len
static final int len(Object[] kvs)
Definition: NonBlockingHashMap.java:138
com.cliffc.aa.util.NonBlockingHashMap.NonBlockingHashMap
NonBlockingHashMap()
Create a new NonBlockingHashMap with default minimum size (currently set to 8 K/V pairs or roughly 84...
Definition: NonBlockingHashMap.java:251
com.cliffc.aa.util.NonBlockingHashMap.SnapshotV.next
TypeV next()
Definition: NonBlockingHashMap.java:1208
com.cliffc.aa.util.NonBlockingHashMap.SnapshotV._nextK
Object _nextK
Definition: NonBlockingHashMap.java:1204
com.cliffc.aa.util.NonBlockingHashMap.SnapshotV._idx
int _idx
Definition: NonBlockingHashMap.java:1203
com.cliffc.aa.util.NonBlockingHashMap.SnapshotV._prevV
TypeV _prevV
Definition: NonBlockingHashMap.java:1205
com.cliffc.aa.util.NonBlockingHashMap.SnapshotV._nextV
TypeV _nextV
Definition: NonBlockingHashMap.java:1205
com.cliffc.aa.util.NonBlockingHashMap.SnapshotV._prevK
Object _prevK
Definition: NonBlockingHashMap.java:1204
com.cliffc.aa.util.NonBlockingHashMap.TOMBSTONE
static final Object TOMBSTONE
Definition: NonBlockingHashMap.java:158
com.cliffc.aa.util.NonBlockingHashMap._kvs
transient Object[] _kvs
Definition: NonBlockingHashMap.java:134
com.cliffc.aa.util.NonBlockingHashMap.SnapshotV.val
Object val(int idx)
Definition: NonBlockingHashMap.java:1202
com.cliffc.aa.util.NonBlockingHashMap.putIfMatch
final TypeV putIfMatch(Object key, Object newVal, Object oldVal)
Definition: NonBlockingHashMap.java:361
com.cliffc.aa.util.NonBlockingHashMap.SnapshotV.length
int length()
Definition: NonBlockingHashMap.java:1200
com.cliffc.aa.util.NonBlockingHashMap.SnapshotV.hasNext
boolean hasNext()
Definition: NonBlockingHashMap.java:1206
com.cliffc.aa.util.NonBlockingHashMap.SnapshotV.key
Object key(int idx)
Definition: NonBlockingHashMap.java:1201
com.cliffc.aa.util.NonBlockingHashMap.chm
static final CHM chm(Object[] kvs)
Definition: NonBlockingHashMap.java:135