kodkod.util.collections
Interface Indexer<K>

All Known Implementing Classes:
FixedMap

public interface Indexer<K>

An index generator for a set of keys. An indexer maps each key in its keyset to a unique integer.

Author:
Emina Torlak
specfield:
keys: set K
indices: keys lone->one int

Method Summary
 int indexOf(K key)
          Returns the index of the given key, if it is in this.keys.
 K keyAt(int index)
          Returns the key at the given index.
 int size()
          Returns the number of keys in this.indexer.
 

Method Detail

indexOf

int indexOf(K key)
Returns the index of the given key, if it is in this.keys. Otherwise returns a negative number.

Returns:
key in this.keys => this.indices[key], {i: int | i < 0 }

keyAt

K keyAt(int index)
Returns the key at the given index.

Returns:
this.indices.index
Throws:
java.lang.IndexOutOfBoundsException - - index !in this.indices[this.keys]

size

int size()
Returns the number of keys in this.indexer.

Returns:
#this.keys