## org.eclipse.ocl
Class LazyExtentMap<CLS,E>

    java.lang.Object
      org.eclipse.ocl.LazyExtentMap<CLS,E>

All Implemented Interfaces:
  Map<CLS,Set<E>>

    public abstract class LazyExtentMap<CLS,E>

extends Object
implements Map<CLS,Set<E>>

A self-populating map that lazily creates the extent of a class when asked for it.

Note that this implementation violates the contract of the `Map` API as follows:

- the `Map.entrySet()` method does not return entries for any keys that have not already been queried via the `Map.get(java.lang.Object)` method
- concomitant to the above item, the `Map.keySet()` and `Map.values()` methods also are not complete

In practice, this does not matter because this map is only used for providing class extents to the OCL engine, and it only does look-up by key. Moreover, this isn't strictly a violation of any contract because there is no way to distinguish this behaviour from concurrent updates.

See the `Environment` class for a description of the generic type parameters of this class.

Nested Class Summary

Nested classes/interfaces inherited from interface java.util.Map
`Map.Entry<K,V>`

Constructor Summary
`LazyExtentMap(EObject context)` Initializes me with the context element of an OCL expression evaluation.

Method Summary
`void` `clear()`
`boolean` `containsKey(Object key)`
`boolean` `containsValue(Object value)`
`Set<Map.Entry<CLS,Set<E>>>` `entrySet()`
`boolean` `equals(Object obj)`
`Set<E>` `get(Object key)` Lazily computes the extent of the specified class `key`.
`int` `hashCode()`
`boolean` `isEmpty()`
`protected abstract boolean` `isInstance(CLS cls, E element)` Implemented by subclasses to determine whether the specified element is an instance of the specified class, according to the metamodel semantics implemented by the environment that created this extent map.
`Set<CLS>` `keySet()`
`Set<E>` `put(CLS key, Set<E> value)`
`void` `putAll(Map<? extends CLS,? extends Set<E>> t)`
`Set<E>` `remove(Object key)`
`int` `size()`
`String` `toString()`
`Collection<Set<E>>` `values()`

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

Constructor Detail

### LazyExtentMap

    public LazyExtentMap(EObject context)

  Initializes me with the context element of an OCL expression evaluation. I discover the scope of the model from this element.

  Parameters:
    `context` - my context element

Method Detail

### get

    public Set<E> get(Object key)

  Lazily computes the extent of the specified class `key`.

  Specified by:
    `get` in interface `Map<CLS,Set<E>>`
  Parameters:
    `key` - a class in the model

### isInstance

    protected abstract boolean isInstance(CLS cls,
                                          E element)

  Implemented by subclasses to determine whether the specified element is an instance of the specified class, according to the metamodel semantics implemented by the environment that created this extent map.

  Parameters:
    `cls` - a class in the model
    `element` - a potential run-time (M0) instance of that class
  Returns:
    `true` if this element is an instance of the given class; `false` otherwise

### clear

    public void clear()

  Specified by:
    `clear` in interface `Map<CLS,Set<E>>`

### containsKey

    public boolean containsKey(Object key)

  Specified by:
    `containsKey` in interface `Map<CLS,Set<E>>`

### containsValue

    public boolean containsValue(Object value)

  Specified by:
    `containsValue` in interface `Map<CLS,Set<E>>`

### entrySet

    public Set<Map.Entry<CLS,Set<E>>> entrySet()

  Specified by:
    `entrySet` in interface `Map<CLS,Set<E>>`

### equals

    public boolean equals(Object obj)

  Specified by:
    `equals` in interface `Map<CLS,Set<E>>`
  Overrides:
    `equals` in class `Object`

### hashCode

    public int hashCode()

  Specified by:
    `hashCode` in interface `Map<CLS,Set<E>>`
  Overrides:
    `hashCode` in class `Object`

### isEmpty

    public boolean isEmpty()

  Specified by:
    `isEmpty` in interface `Map<CLS,Set<E>>`

### keySet

    public Set<CLS> keySet()

  Specified by:
    `keySet` in interface `Map<CLS,Set<E>>`

### put

    public Set<E> put(CLS key,
                      Set<E> value)

  Specified by:
    `put` in interface `Map<CLS,Set<E>>`

### putAll

    public void putAll(Map<? extends CLS,? extends Set<E>> t)

  Specified by:
    `putAll` in interface `Map<CLS,Set<E>>`

### remove

    public Set<E> remove(Object key)

  Specified by:
    `remove` in interface `Map<CLS,Set<E>>`

### size

    public int size()

  Specified by:
    `size` in interface `Map<CLS,Set<E>>`

### toString

    public String toString()

  Overrides:
    `toString` in class `Object`

### values

    public Collection<Set<E>> values()

  Specified by:
    `values` in interface `Map<CLS,Set<E>>`

Copyright 2002, 2007 IBM Corporation and others. All Rights Reserved.