com.androidplot.util
Class ZHash<KeyType,ValueType>

java.lang.Object
  extended by com.androidplot.util.ZHash<KeyType,ValueType>
All Implemented Interfaces:
ZIndexable<KeyType>

public class ZHash<KeyType,ValueType>
extends Object
implements ZIndexable<KeyType>

Concrete implementation of ZIndexable. Provides fast element retrieval via hash key. Also provides mutable ordering (z indexing) of elements.


Constructor Summary
ZHash()
           
 
Method Summary
 void addToBottom(KeyType key, ValueType value)
          If key already exists within the structure, it's value is replaced with the new value and it's existing order is maintained.
 void addToTop(KeyType key, ValueType value)
          If key already exists within the structure, it's value is replaced with the new value and it's existing order is maintained.
 List<KeyType> elements()
           
 ValueType get(KeyType key)
           
 List<KeyType> getKeysAsList()
           
 List<KeyType> keys()
           
 boolean moveAbove(KeyType objectToMove, KeyType reference)
          Move above the specified element
 boolean moveBeneath(KeyType objectToMove, KeyType reference)
          Move beneath the specified element
 boolean moveDown(KeyType key)
          Move down by one element
 boolean moveToBottom(KeyType key)
          Move beneath all other elements
 boolean moveToTop(KeyType element)
          Move above all other elements
 boolean moveUp(KeyType key)
          Move up by one element
 boolean remove(KeyType key)
           
 int size()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ZHash

public ZHash()
Method Detail

size

public int size()

get

public ValueType get(KeyType key)

getKeysAsList

public List<KeyType> getKeysAsList()

addToTop

public void addToTop(KeyType key,
                     ValueType value)
If key already exists within the structure, it's value is replaced with the new value and it's existing order is maintained.

Parameters:
key -
value -

addToBottom

public void addToBottom(KeyType key,
                        ValueType value)
If key already exists within the structure, it's value is replaced with the new value and it's existing order is maintained.

Parameters:
key -
value -

moveToTop

public boolean moveToTop(KeyType element)
Description copied from interface: ZIndexable
Move above all other elements

Specified by:
moveToTop in interface ZIndexable<KeyType>
Returns:

moveAbove

public boolean moveAbove(KeyType objectToMove,
                         KeyType reference)
Description copied from interface: ZIndexable
Move above the specified element

Specified by:
moveAbove in interface ZIndexable<KeyType>
Returns:

moveBeneath

public boolean moveBeneath(KeyType objectToMove,
                           KeyType reference)
Description copied from interface: ZIndexable
Move beneath the specified element

Specified by:
moveBeneath in interface ZIndexable<KeyType>
Returns:

moveToBottom

public boolean moveToBottom(KeyType key)
Description copied from interface: ZIndexable
Move beneath all other elements

Specified by:
moveToBottom in interface ZIndexable<KeyType>
Returns:

moveUp

public boolean moveUp(KeyType key)
Description copied from interface: ZIndexable
Move up by one element

Specified by:
moveUp in interface ZIndexable<KeyType>
Returns:

moveDown

public boolean moveDown(KeyType key)
Description copied from interface: ZIndexable
Move down by one element

Specified by:
moveDown in interface ZIndexable<KeyType>
Returns:

elements

public List<KeyType> elements()
Specified by:
elements in interface ZIndexable<KeyType>

keys

public List<KeyType> keys()
Returns:
Ordered list of keys.

remove

public boolean remove(KeyType key)


Copyright © 2010-2013 androidplot.com. All Rights Reserved.