Javolution 6.0.0 java
javolution.util.internal.map.MapView< K, V > Class Template Referenceabstract
Inheritance diagram for javolution.util.internal.map.MapView< K, V >:
[legend]
Collaboration diagram for javolution.util.internal.map.MapView< K, V >:
[legend]

Classes

class  EntryComparator
 
class  EntrySet
 
class  KeySet
 
class  Values
 

Public Member Functions

 MapView (MapService< K, V > target)
 
void clear ()
 
MapView< K, V > clone ()
 
abstract boolean containsKey (Object key)
 
boolean containsValue (Object value)
 
SetService< Entry< K, V > > entrySet ()
 
abstract V get (Object key)
 
boolean isEmpty ()
 
abstract Iterator< Entry< K, V > > iterator ()
 
abstract Equality<? super K > keyComparator ()
 
SetService< K > keySet ()
 
void perform (Consumer< MapService< K, V >> action, MapService< K, V > view)
 
abstract V put (K key, V value)
 
void putAll (Map<? extends K, ? extends V > m)
 
putIfAbsent (K key, V value)
 
abstract V remove (Object key)
 
boolean remove (Object key, Object value)
 
replace (K key, V value)
 
boolean replace (K key, V oldValue, V newValue)
 
int size ()
 
MapService< K, V >[] split (int n)
 
MapService< K, V > threadSafe ()
 
void update (Consumer< MapService< K, V >> action, MapService< K, V > view)
 
abstract Equality<? super V > valueComparator ()
 
CollectionService< V > values ()
 
void perform (Consumer< T > action, T part)
 
void update (Consumer< T > action, T part)
 

Protected Member Functions

MapService< K, V > target ()
 

Private Attributes

MapService< K, V > target
 

Static Private Attributes

static final long serialVersionUID = 0x600L
 

Detailed Description

Map view implementation; can be used as root class for implementations if target is

null

.

Definition at line 29 of file MapView.java.

Constructor & Destructor Documentation

◆ MapView()

The view constructor or root class constructor if target is

null

.

Definition at line 218 of file MapView.java.

218  {
219  this.target = target;
220  }

References javolution.util.internal.map.MapView< K, V >.target.

Member Function Documentation

◆ clear()

void javolution.util.internal.map.MapView< K, V >.clear ( )

Reimplemented in javolution.util.internal.map.SharedMapImpl< K, V >, javolution.util.internal.map.AtomicMapImpl< K, V >, javolution.util.internal.map.UnmodifiableMapImpl< K, V >, and javolution.util.internal.map.FastMapImpl< K, V >.

Definition at line 223 of file MapView.java.

223  {
224  Iterator<Entry<K, V>> it = iterator();
225  while (it.hasNext()) {
226  it.remove();
227  }
228  }

References javolution.util.internal.map.MapView< K, V >.iterator().

Here is the call graph for this function:

◆ clone()

Returns a copy of this map; updates of the copy should not impact the original.

Implements javolution.util.service.MapService< K, V >.

Reimplemented in javolution.util.internal.map.AtomicMapImpl< K, V >, and javolution.util.internal.map.FastMapImpl< K, V >.

Definition at line 232 of file MapView.java.

232  {
233  try {
234  MapView<K, V> copy = (MapView<K, V>) super.clone();
235  if (target != null) { // Not a root class.
236  copy.target = target.clone();
237  }
238  return copy;
239  } catch (CloneNotSupportedException e) {
240  throw new Error("Should not happen since target is cloneable");
241  }
242  }

References javolution.util.internal.map.MapView< K, V >.clone(), and javolution.util.internal.map.MapView< K, V >.target.

Referenced by javolution.util.internal.map.MapView< K, V >.clone(), and javolution.util.internal.map.MapView< K, V >.split().

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

◆ containsKey()

◆ containsValue()

boolean javolution.util.internal.map.MapView< K, V >.containsValue ( Object  value)

Reimplemented in javolution.util.internal.map.SharedMapImpl< K, V >, and javolution.util.internal.map.AtomicMapImpl< K, V >.

Definition at line 248 of file MapView.java.

248  {
249  return values().contains(value);
250  }

References javolution.util.internal.map.MapView< K, V >.values().

Here is the call graph for this function:

◆ entrySet()

SetService<Entry<K, V> > javolution.util.internal.map.MapView< K, V >.entrySet ( )

Returns a set view over the entries of this map. The set support adding/removing entries. Two entries are considered equals if they have the same key regardless of their values.

Implements javolution.util.service.MapService< K, V >.

Reimplemented in javolution.util.internal.map.sorted.SortedMapView< K, V >, javolution.util.internal.map.sorted.SharedSortedMapImpl< K, V >, javolution.util.internal.map.sorted.AtomicSortedMapImpl< K, V >, and javolution.util.internal.map.sorted.UnmodifiableSortedMapImpl< K, V >.

Definition at line 253 of file MapView.java.

253  {
254  return new EntrySet();
255  }

Referenced by javolution.util.internal.map.MapView< K, V >.KeySet.KeySet(), and javolution.util.internal.map.MapView< K, V >.Values.Values().

Here is the caller graph for this function:

◆ get()

◆ isEmpty()

boolean javolution.util.internal.map.MapView< K, V >.isEmpty ( )

Reimplemented in javolution.util.internal.map.SharedMapImpl< K, V >, and javolution.util.internal.map.AtomicMapImpl< K, V >.

Definition at line 261 of file MapView.java.

261  {
262  return iterator().hasNext();
263  }

References javolution.util.internal.map.MapView< K, V >.iterator().

Referenced by javolution.util.internal.map.MapView< K, V >.EntrySet.isEmpty().

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

◆ iterator()

◆ keyComparator()

◆ keySet()

Returns a set view over the key of this map, the set support adding new key for which the value is automatically

null

.

Implements javolution.util.service.MapService< K, V >.

Reimplemented in javolution.util.internal.map.sorted.SortedMapView< K, V >, javolution.util.internal.map.sorted.SharedSortedMapImpl< K, V >, javolution.util.internal.map.sorted.AtomicSortedMapImpl< K, V >, and javolution.util.internal.map.sorted.UnmodifiableSortedMapImpl< K, V >.

Definition at line 272 of file MapView.java.

272  {
273  return new KeySet();
274  }

Referenced by javolution.util.FastSet< Index >.FastSet().

Here is the caller graph for this function:

◆ perform() [1/2]

void javolution.util.internal.map.MapView< K, V >.perform ( Consumer< MapService< K, V >>  action,
MapService< K, V >  view 
)

Reimplemented in javolution.util.internal.map.ParallelMapImpl< K, V >, and javolution.util.internal.map.SequentialMapImpl< K, V >.

Definition at line 277 of file MapView.java.

277  {
278  if (target == null) {
279  action.accept(view);
280  } else {
281  target.perform(action, view);
282  }
283  }

References javolution.util.internal.map.MapView< K, V >.target.

Referenced by javolution.util.internal.map.MapView< K, V >.EntrySet.perform().

Here is the caller graph for this function:

◆ perform() [2/2]

void javolution.util.function.Splittable< T >.perform ( Consumer< T >  action,
part 
)
inherited

Executes a read-only action on the specified part of this object.

Parameters
actionthe read-only action.
partthis object or a part of it.
Exceptions
UnsupportedOperationExceptionif the action tries to update the specified part.

◆ put()

◆ putAll()

void javolution.util.internal.map.MapView< K, V >.putAll ( Map<? extends K, ? extends V >  m)

Reimplemented in javolution.util.internal.map.SharedMapImpl< K, V >, and javolution.util.internal.map.AtomicMapImpl< K, V >.

Definition at line 290 of file MapView.java.

290  {
291  Iterator<?> it = m.entrySet().iterator();
292  while (it.hasNext()) {
293  Entry<K, V> e = (Entry<K, V>) it.next();
294  put(e.getKey(), e.getValue());
295  }
296  }

References javolution.util.internal.map.MapView< K, V >.put().

Referenced by javolution.util.internal.map.FastMapImpl< K, V >.clone().

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

◆ putIfAbsent()

V javolution.util.internal.map.MapView< K, V >.putIfAbsent ( key,
value 
)

Reimplemented in javolution.util.internal.map.SharedMapImpl< K, V >, javolution.util.internal.map.FastMapImpl< K, V >, and javolution.util.internal.map.AtomicMapImpl< K, V >.

Definition at line 299 of file MapView.java.

299  {
300  if (!containsKey(key)) return put(key, value);
301  else return get(key);
302  }

References javolution.util.internal.map.MapView< K, V >.containsKey(), and javolution.util.internal.map.MapView< K, V >.put().

Here is the call graph for this function:

◆ remove() [1/2]

◆ remove() [2/2]

boolean javolution.util.internal.map.MapView< K, V >.remove ( Object  key,
Object  value 
)

Reimplemented in javolution.util.internal.map.SharedMapImpl< K, V >, javolution.util.internal.map.FastMapImpl< K, V >, and javolution.util.internal.map.AtomicMapImpl< K, V >.

Definition at line 308 of file MapView.java.

308  {
309  if (containsKey(key) && get(key).equals(value)) {
310  remove(key);
311  return true;
312  } else return false;
313  }

References javolution.util.internal.map.MapView< K, V >.containsKey().

Here is the call graph for this function:

◆ replace() [1/2]

boolean javolution.util.internal.map.MapView< K, V >.replace ( key,
oldValue,
newValue 
)

Reimplemented in javolution.util.internal.map.SharedMapImpl< K, V >, javolution.util.internal.map.FastMapImpl< K, V >, and javolution.util.internal.map.AtomicMapImpl< K, V >.

Definition at line 323 of file MapView.java.

323  {
324  if (containsKey(key) && get(key).equals(oldValue)) {
325  put(key, newValue);
326  return true;
327  } else return false;
328  }

References javolution.util.internal.map.MapView< K, V >.containsKey(), and javolution.util.internal.map.MapView< K, V >.put().

Here is the call graph for this function:

◆ replace() [2/2]

V javolution.util.internal.map.MapView< K, V >.replace ( key,
value 
)

Reimplemented in javolution.util.internal.map.SharedMapImpl< K, V >, javolution.util.internal.map.FastMapImpl< K, V >, and javolution.util.internal.map.AtomicMapImpl< K, V >.

Definition at line 316 of file MapView.java.

316  {
317  if (containsKey(key)) {
318  return put(key, value);
319  } else return null;
320  }

References javolution.util.internal.map.MapView< K, V >.containsKey(), and javolution.util.internal.map.MapView< K, V >.put().

Here is the call graph for this function:

◆ size()

Reimplemented in javolution.util.internal.map.SharedMapImpl< K, V >, javolution.util.internal.map.FastMapImpl< K, V >, and javolution.util.internal.map.AtomicMapImpl< K, V >.

Definition at line 331 of file MapView.java.

331  {
332  int count = 0;
333  Iterator<Entry<K, V>> it = iterator();
334  while (it.hasNext()) {
335  count++;
336  it.next();
337  }
338  return count;
339  }

References javolution.util.internal.map.MapView< K, V >.iterator().

Referenced by javolution.util.internal.map.sorted.FastSortedMapImpl< K, V >.put(), and javolution.util.internal.map.MapView< K, V >.EntrySet.size().

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

◆ split()

MapService<K, V> [] javolution.util.internal.map.MapView< K, V >.split ( int  n)

Returns

n

distinct parts of this object. This method may return an array of size less than

n

(e.g. an array of size one if this object cannot split).

Parameters
nthe number of parts.
Returns
the distinct parts (or views) for this object.
Exceptions
IllegalArgumentExceptionif
n <= 1

Implements javolution.util.function.Splittable< T >.

Reimplemented in javolution.util.internal.map.SharedMapImpl< K, V >, javolution.util.internal.map.FastMapImpl< K, V >, and javolution.util.internal.map.AtomicMapImpl< K, V >.

Definition at line 343 of file MapView.java.

343  {
344  if (target == null) return new MapService[] { this }; // No split.
345  MapService<K, V>[] subTargets = target.split(n);
346  MapService<K, V>[] result = new MapService[subTargets.length];
347  for (int i = 0; i < subTargets.length; i++) {
348  MapView<K, V> copy = this.clone();
349  copy.target = subTargets[i];
350  result[i] = copy;
351  }
352  return result;
353  }

References javolution.util.internal.map.MapView< K, V >.clone(), and javolution.util.internal.map.MapView< K, V >.target.

Referenced by javolution.util.internal.map.MapView< K, V >.EntrySet.split().

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

◆ target()

◆ threadSafe()

◆ update() [1/2]

void javolution.util.internal.map.MapView< K, V >.update ( Consumer< MapService< K, V >>  action,
MapService< K, V >  view 
)

Reimplemented in javolution.util.internal.map.ParallelMapImpl< K, V >, javolution.util.internal.map.AtomicMapImpl< K, V >, and javolution.util.internal.map.SequentialMapImpl< K, V >.

Definition at line 361 of file MapView.java.

361  {
362  if (target == null) {
363  action.accept(view);
364  } else {
365  target.update(action, view);
366  }
367  }

References javolution.util.internal.map.MapView< K, V >.target.

Referenced by javolution.util.internal.map.MapView< K, V >.EntrySet.update().

Here is the caller graph for this function:

◆ update() [2/2]

void javolution.util.function.Splittable< T >.update ( Consumer< T >  action,
part 
)
inherited

Executes an update action on the specified part of this object. Any change to the part is reflected in the whole (this object).

Parameters
actionthe action authorized to update this object part.
partthis object or a part of it.

◆ valueComparator()

◆ values()

Returns a collection view over the values of this map, the collection support value/entry removal but not adding new values.

Implements javolution.util.service.MapService< K, V >.

Definition at line 373 of file MapView.java.

373  {
374  return new Values();
375  }

Referenced by javolution.util.internal.map.MapView< K, V >.containsValue().

Here is the caller graph for this function:

Member Data Documentation

◆ serialVersionUID

final long javolution.util.internal.map.MapView< K, V >.serialVersionUID = 0x600L
staticprivate

Definition at line 212 of file MapView.java.

◆ target

MapService<K, V> javolution.util.internal.map.MapView< K, V >.target
private

Reimplemented in javolution.util.internal.map.sorted.SortedMapView< K, V >, javolution.util.internal.map.sorted.SharedSortedMapImpl< K, V >, and javolution.util.internal.map.sorted.UnmodifiableSortedMapImpl< K, V >.

Definition at line 213 of file MapView.java.

Referenced by javolution.util.internal.map.AtomicMapImpl< K, V >.AtomicMapImpl(), javolution.util.internal.map.sorted.AtomicSortedMapImpl< K, V >.AtomicSortedMapImpl(), javolution.util.internal.map.SharedMapImpl< K, V >.clear(), javolution.util.internal.map.MapView< K, V >.clone(), javolution.util.internal.map.AtomicMapImpl< K, V >.cloneTarget(), javolution.util.internal.map.SharedMapImpl< K, V >.cloneTarget(), javolution.util.internal.map.sorted.AtomicSortedMapImpl< K, V >.comparator(), javolution.util.internal.map.SequentialMapImpl< K, V >.containsKey(), javolution.util.internal.map.ParallelMapImpl< K, V >.containsKey(), javolution.util.internal.map.UnmodifiableMapImpl< K, V >.containsKey(), javolution.util.internal.map.SharedMapImpl< K, V >.containsKey(), javolution.util.internal.map.SharedMapImpl< K, V >.containsValue(), javolution.util.internal.map.SequentialMapImpl< K, V >.get(), javolution.util.internal.map.ParallelMapImpl< K, V >.get(), javolution.util.internal.map.UnmodifiableMapImpl< K, V >.get(), javolution.util.internal.map.SharedMapImpl< K, V >.get(), javolution.util.internal.map.SharedMapImpl< K, V >.isEmpty(), javolution.util.internal.map.SequentialMapImpl< K, V >.iterator(), javolution.util.internal.map.ParallelMapImpl< K, V >.iterator(), javolution.util.internal.map.SequentialMapImpl< K, V >.keyComparator(), javolution.util.internal.map.ParallelMapImpl< K, V >.keyComparator(), javolution.util.internal.map.UnmodifiableMapImpl< K, V >.keyComparator(), javolution.util.internal.map.SharedMapImpl< K, V >.keyComparator(), javolution.util.internal.map.MapView< K, V >.MapView(), javolution.util.internal.map.ParallelMapImpl< K, V >.ParallelMapImpl(), javolution.util.internal.map.ParallelMapImpl< K, V >.perform(), javolution.util.internal.map.MapView< K, V >.perform(), javolution.util.internal.map.SequentialMapImpl< K, V >.put(), javolution.util.internal.map.ParallelMapImpl< K, V >.put(), javolution.util.internal.map.AtomicMapImpl< K, V >.put(), javolution.util.internal.map.SharedMapImpl< K, V >.put(), javolution.util.internal.map.AtomicMapImpl< K, V >.putAll(), javolution.util.internal.map.SharedMapImpl< K, V >.putAll(), javolution.util.internal.map.AtomicMapImpl< K, V >.putIfAbsent(), javolution.util.internal.map.SharedMapImpl< K, V >.putIfAbsent(), javolution.util.internal.map.SequentialMapImpl< K, V >.remove(), javolution.util.internal.map.ParallelMapImpl< K, V >.remove(), javolution.util.internal.map.AtomicMapImpl< K, V >.remove(), javolution.util.internal.map.SharedMapImpl< K, V >.remove(), javolution.util.internal.map.AtomicMapImpl< K, V >.replace(), javolution.util.internal.map.SharedMapImpl< K, V >.replace(), javolution.util.internal.map.SequentialMapImpl< K, V >.SequentialMapImpl(), javolution.util.internal.map.SharedMapImpl< K, V >.SharedMapImpl(), javolution.util.internal.map.SharedMapImpl< K, V >.size(), javolution.util.internal.map.SharedMapImpl< K, V >.split(), javolution.util.internal.map.MapView< K, V >.split(), javolution.util.internal.map.MapView< K, V >.target(), javolution.util.internal.map.AtomicMapImpl< K, V >.targetView(), javolution.util.internal.map.UnmodifiableMapImpl< K, V >.UnmodifiableMapImpl(), javolution.util.internal.map.ParallelMapImpl< K, V >.update(), javolution.util.internal.map.AtomicMapImpl< K, V >.update(), javolution.util.internal.map.MapView< K, V >.update(), javolution.util.internal.map.SequentialMapImpl< K, V >.valueComparator(), javolution.util.internal.map.UnmodifiableMapImpl< K, V >.valueComparator(), javolution.util.internal.map.ParallelMapImpl< K, V >.valueComparator(), and javolution.util.internal.map.SharedMapImpl< K, V >.valueComparator().


The documentation for this class was generated from the following file:
javolution.util.internal.map.MapView.iterator
abstract Iterator< Entry< K, V > > iterator()
javolution.util.internal.map.MapView.put
abstract V put(K key, V value)
javolution.util.internal.map.MapView.containsKey
abstract boolean containsKey(Object key)
javolution.util.internal.map.MapView.clone
MapView< K, V > clone()
Definition: MapView.java:232
javolution.util.internal.map.MapView.values
CollectionService< V > values()
Definition: MapView.java:373
EntrySet
javolution.util.internal.map.MapView.target
MapService< K, V > target
Definition: MapView.java:213