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

Public Member Functions

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

Package Functions

long key (final int idx)
 
int length ()
 

Package Attributes

long _prevK
 
TypeV _prevV
 
final CHM _sschm
 

Private Attributes

int _idx
 
long _nextK
 
TypeV _nextV
 

Detailed Description

Definition at line 1029 of file NonBlockingHashMapLong.java.

Constructor & Destructor Documentation

◆ SnapshotV()

com.cliffc.aa.util.NonBlockingHashMapLong< TypeV >.SnapshotV.SnapshotV ( )

Definition at line 1031 of file NonBlockingHashMapLong.java.

1031  {
1032  CHM topchm;
1033  while( true ) { // Verify no table-copy-in-progress
1034  topchm = _chm;
1035  if( topchm._newchm == null ) // No table-copy-in-progress
1036  break;
1037  // Table copy in-progress - so we cannot get a clean iteration. We
1038  // must help finish the table copy before we can start iterating.
1039  topchm.help_copy_impl(true);
1040  }
1041  // The "linearization point" for the iteration. Every key in this table
1042  // will be visited, but keys added later might be skipped or even be
1043  // added to a following table (also not iterated over).
1044  _sschm = topchm;
1045  // Warm-up the iterator
1046  _idx = -1;
1047  next();
1048  }

References com.cliffc.aa.util.NonBlockingHashMapLong< TypeV >._chm, com.cliffc.aa.util.NonBlockingHashMapLong< TypeV >.SnapshotV._idx, com.cliffc.aa.util.NonBlockingHashMapLong< TypeV >.CHM._newchm, com.cliffc.aa.util.NonBlockingHashMapLong< TypeV >.SnapshotV._sschm, com.cliffc.aa.util.NonBlockingHashMapLong< TypeV >.CHM.help_copy_impl(), and com.cliffc.aa.util.NonBlockingHashMapLong< TypeV >.SnapshotV.next().

Here is the call graph for this function:

Member Function Documentation

◆ hasMoreElements()

boolean com.cliffc.aa.util.NonBlockingHashMapLong< TypeV >.SnapshotV.hasMoreElements ( )

Definition at line 1096 of file NonBlockingHashMapLong.java.

1096 { return hasNext(); }

References com.cliffc.aa.util.NonBlockingHashMapLong< TypeV >.SnapshotV.hasNext().

Here is the call graph for this function:

◆ hasNext()

boolean com.cliffc.aa.util.NonBlockingHashMapLong< TypeV >.SnapshotV.hasNext ( )

Definition at line 1054 of file NonBlockingHashMapLong.java.

1054 { return _nextV != null; }

References com.cliffc.aa.util.NonBlockingHashMapLong< TypeV >.SnapshotV._nextV.

Referenced by com.cliffc.aa.util.NonBlockingHashMapLong< TypeV >.SnapshotV.hasMoreElements(), com.cliffc.aa.util.NonBlockingHashMapLong< TypeV >.IteratorLong.hasNext(), and com.cliffc.aa.util.NonBlockingHashMapLong< TypeV >.SnapshotE.hasNext().

Here is the caller graph for this function:

◆ key()

long com.cliffc.aa.util.NonBlockingHashMapLong< TypeV >.SnapshotV.key ( final int  idx)
package

Definition at line 1050 of file NonBlockingHashMapLong.java.

1050 { return _sschm._keys[idx]; }

References com.cliffc.aa.util.NonBlockingHashMapLong< TypeV >.CHM._keys, and com.cliffc.aa.util.NonBlockingHashMapLong< TypeV >.SnapshotV._sschm.

Referenced by com.cliffc.aa.util.NonBlockingHashMapLong< TypeV >.SnapshotV.next().

Here is the caller graph for this function:

◆ length()

int com.cliffc.aa.util.NonBlockingHashMapLong< TypeV >.SnapshotV.length ( )
package

Definition at line 1049 of file NonBlockingHashMapLong.java.

1049 { return _sschm._keys.length; }

References com.cliffc.aa.util.NonBlockingHashMapLong< TypeV >.CHM._keys, and com.cliffc.aa.util.NonBlockingHashMapLong< TypeV >.SnapshotV._sschm.

Referenced by com.cliffc.aa.util.NonBlockingHashMapLong< TypeV >.SnapshotV.next().

Here is the caller graph for this function:

◆ next()

TypeV com.cliffc.aa.util.NonBlockingHashMapLong< TypeV >.SnapshotV.next ( )

Definition at line 1055 of file NonBlockingHashMapLong.java.

1055  {
1056  // 'next' actually knows what the next value will be - it had to
1057  // figure that out last go 'round lest 'hasNext' report true and
1058  // some other thread deleted the last value. Instead, 'next'
1059  // spends all its effort finding the key that comes after the
1060  // 'next' key.
1061  if( _idx != -1 && _nextV == null ) throw new NoSuchElementException();
1062  _prevK = _nextK; // This will become the previous key
1063  _prevV = _nextV; // This will become the previous value
1064  _nextV = null; // We have no more next-key
1065  // Attempt to set <_nextK,_nextV> to the next K,V pair.
1066  // _nextV is the trigger: stop searching when it is != null
1067  if( _idx == -1 ) { // Check for NO_KEY
1068  _idx = 0; // Setup for next phase of search
1069  _nextK = NO_KEY;
1070  if( (_nextV=get(_nextK)) != null ) return _prevV;
1071  }
1072  while( _idx<length() ) { // Scan array
1073  _nextK = key(_idx++); // Get a key that definitely is in the set (for the moment!)
1074  if( _nextK != NO_KEY && // Found something?
1075  (_nextV=get(_nextK)) != null )
1076  break; // Got it! _nextK is a valid Key
1077  } // Else keep scanning
1078  return _prevV; // Return current value.
1079  }

References com.cliffc.aa.util.NonBlockingHashMapLong< TypeV >.SnapshotV._idx, com.cliffc.aa.util.NonBlockingHashMapLong< TypeV >.SnapshotV._nextK, com.cliffc.aa.util.NonBlockingHashMapLong< TypeV >.SnapshotV._nextV, com.cliffc.aa.util.NonBlockingHashMapLong< TypeV >.SnapshotV._prevK, com.cliffc.aa.util.NonBlockingHashMapLong< TypeV >.SnapshotV._prevV, com.cliffc.aa.util.NonBlockingHashMapLong< TypeV >.SnapshotV.key(), com.cliffc.aa.util.NonBlockingHashMapLong< TypeV >.SnapshotV.length(), and com.cliffc.aa.util.NonBlockingHashMapLong< TypeV >.NO_KEY.

Referenced by com.cliffc.aa.util.NonBlockingHashMapLong< TypeV >.IteratorLong.next(), com.cliffc.aa.util.NonBlockingHashMapLong< TypeV >.SnapshotE.next(), com.cliffc.aa.util.NonBlockingHashMapLong< TypeV >.SnapshotV.nextElement(), com.cliffc.aa.util.NonBlockingHashMapLong< TypeV >.IteratorLong.nextLong(), and com.cliffc.aa.util.NonBlockingHashMapLong< 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.NonBlockingHashMapLong< TypeV >.SnapshotV.nextElement ( )

Definition at line 1095 of file NonBlockingHashMapLong.java.

1095 { return next(); }

References com.cliffc.aa.util.NonBlockingHashMapLong< TypeV >.SnapshotV.next().

Here is the call graph for this function:

◆ remove()

void com.cliffc.aa.util.NonBlockingHashMapLong< TypeV >.SnapshotV.remove ( )

Definition at line 1088 of file NonBlockingHashMapLong.java.

1088  {
1089  // NOTE: it would seem logical that value removal will semantically mean
1090  // removing the matching value for the mapping <k,v>, but the JDK always
1091  // removes by key, even when the value has changed.
1092  removeKey();
1093  }

References com.cliffc.aa.util.NonBlockingHashMapLong< TypeV >.SnapshotV.removeKey().

Here is the call graph for this function:

◆ removeKey()

void com.cliffc.aa.util.NonBlockingHashMapLong< TypeV >.SnapshotV.removeKey ( )

Definition at line 1081 of file NonBlockingHashMapLong.java.

1081  {
1082  if( _prevV == null ) throw new IllegalStateException();
1084  _prevV = null;
1085  }

References com.cliffc.aa.util.NonBlockingHashMapLong< TypeV >.SnapshotV._prevK, com.cliffc.aa.util.NonBlockingHashMapLong< TypeV >.SnapshotV._prevV, com.cliffc.aa.util.NonBlockingHashMapLong< TypeV >.NO_MATCH_OLD, com.cliffc.aa.util.NonBlockingHashMapLong< TypeV >.putIfMatch(), and com.cliffc.aa.util.NonBlockingHashMapLong< TypeV >.TOMBSTONE.

Referenced by com.cliffc.aa.util.NonBlockingHashMapLong< TypeV >.SnapshotV.remove(), com.cliffc.aa.util.NonBlockingHashMapLong< TypeV >.IteratorLong.remove(), and com.cliffc.aa.util.NonBlockingHashMapLong< TypeV >.SnapshotE.remove().

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

Member Data Documentation

◆ _idx

◆ _nextK

◆ _nextV

◆ _prevK

◆ _prevV

◆ _sschm


The documentation for this class was generated from the following file:
com.cliffc.aa.util.NonBlockingHashMapLong._chm
transient CHM _chm
Definition: NonBlockingHashMapLong.java:131
com.cliffc.aa.util.NonBlockingHashMapLong.CHM.help_copy_impl
void help_copy_impl(final boolean copy_all)
Definition: NonBlockingHashMapLong.java:861
com.cliffc.aa.util.NonBlockingHashMapLong.SnapshotV._sschm
final CHM _sschm
Definition: NonBlockingHashMapLong.java:1030
com.cliffc.aa.util.NonBlockingHashMapLong.NonBlockingHashMapLong
NonBlockingHashMapLong()
Create a new NonBlockingHashMapLong with default minimum size (currently set to 8 K/V pairs or roughl...
Definition: NonBlockingHashMapLong.java:219
com.cliffc.aa.util.NonBlockingHashMapLong.SnapshotV._idx
int _idx
Definition: NonBlockingHashMapLong.java:1051
com.cliffc.aa.util.NonBlockingHashMapLong.SnapshotV.removeKey
void removeKey()
Definition: NonBlockingHashMapLong.java:1081
com.cliffc.aa.util.NonBlockingHashMapLong.SnapshotV.hasNext
boolean hasNext()
Definition: NonBlockingHashMapLong.java:1054
com.cliffc.aa.util.NonBlockingHashMapLong.SnapshotV._prevK
long _prevK
Definition: NonBlockingHashMapLong.java:1052
com.cliffc.aa.util.NonBlockingHashMapLong.NO_KEY
static final long NO_KEY
Definition: NonBlockingHashMapLong.java:167
com.cliffc.aa.util.NonBlockingHashMapLong.SnapshotV.key
long key(final int idx)
Definition: NonBlockingHashMapLong.java:1050
com.cliffc.aa.util.NonBlockingHashMapLong.TOMBSTONE
static final Object TOMBSTONE
Definition: NonBlockingHashMapLong.java:157
com.cliffc.aa.util.NonBlockingHashMapLong.SnapshotV.next
TypeV next()
Definition: NonBlockingHashMapLong.java:1055
com.cliffc.aa.util.NonBlockingHashMapLong.CHM._keys
final long[] _keys
Definition: NonBlockingHashMapLong.java:486
com.cliffc.aa.util.NonBlockingHashMapLong.SnapshotV.length
int length()
Definition: NonBlockingHashMapLong.java:1049
com.cliffc.aa.util.NonBlockingHashMapLong.NO_MATCH_OLD
static final Object NO_MATCH_OLD
Definition: NonBlockingHashMapLong.java:151
com.cliffc.aa.util.NonBlockingHashMapLong.SnapshotV._nextK
long _nextK
Definition: NonBlockingHashMapLong.java:1052
com.cliffc.aa.util.NonBlockingHashMapLong.SnapshotV._nextV
TypeV _nextV
Definition: NonBlockingHashMapLong.java:1053
com.cliffc.aa.util.NonBlockingHashMapLong.SnapshotV._prevV
TypeV _prevV
Definition: NonBlockingHashMapLong.java:1053