genopt.db
Class OrderedMap

java.lang.Object
  extended by genopt.db.OrderedMap

public class OrderedMap
extends java.lang.Object

Object representing an ordered map, similar to HashMap, but order is preserved.

This project was carried out at:

and supported by

GenOpt Copyright (c) 1998-2011, The Regents of the University of California, through Lawrence Berkeley National Laboratory (subject to receipt of any required approvals from the U.S. Dept. of Energy). All rights reserved.

Version:
GenOpt(R) 3.1.0 (December 8, 2011)

Author:
Michael Wetter

Field Summary
protected  java.lang.Object[][] map
          mapping key -> value
protected  int nK
          the number of keys in the map
 
Constructor Summary
OrderedMap()
          constructor
 
Method Summary
 boolean containsKey(java.lang.Object o)
          returns true if the Object is a key in the Map, false otherwise
 boolean containsValue(java.lang.Object o)
          returns true if the Object is a value in the Map, false otherwise
 java.lang.Object get(java.lang.Object key)
          get the value of the key
 java.lang.Object[] getKeys()
          get the keys
 java.lang.Object getValue(int i)
          get the i-th value
 java.lang.Object[] getValues()
          get the values
private  void increaseCapacity()
          increases the capacity of the mapping
static void main(java.lang.String[] args)
           
 void put(java.lang.Object key, java.lang.Object value)
          puts a pair (key,value) in the map
 java.lang.Object setValue(int i, java.lang.Object value)
          sets the value of the i-th entry
 int size()
          returns the number of keys in this Map
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

map

protected java.lang.Object[][] map
mapping key -> value


nK

protected int nK
the number of keys in the map

Constructor Detail

OrderedMap

public OrderedMap()
constructor

Method Detail

put

public void put(java.lang.Object key,
                java.lang.Object value)
puts a pair (key,value) in the map

Parameters:
key - key of the pair
value - value of the pair

increaseCapacity

private void increaseCapacity()
increases the capacity of the mapping


containsKey

public boolean containsKey(java.lang.Object o)
returns true if the Object is a key in the Map, false otherwise

Parameters:
o - Object to be compared against the keys
Returns:
true if Object is already in Map, false otherwise

containsValue

public boolean containsValue(java.lang.Object o)
returns true if the Object is a value in the Map, false otherwise

Parameters:
o - Object to be compared against the values
Returns:
true if Object is already in Map, false otherwise

getKeys

public java.lang.Object[] getKeys()
get the keys

Returns:
the keys of the Map

getValues

public java.lang.Object[] getValues()
get the values

Returns:
the values of the Map

getValue

public java.lang.Object getValue(int i)
get the i-th value

Returns:
the i-th value

get

public java.lang.Object get(java.lang.Object key)
get the value of the key

Parameters:
key - the key for which the value will be returned
Returns:
the value of the key

setValue

public java.lang.Object setValue(int i,
                                 java.lang.Object value)
sets the value of the i-th entry

Parameters:
i - the number of the value
Returns:
value the value of the i-th entry

size

public int size()
returns the number of keys in this Map

Returns:
he number of keys in this Map

main

public static void main(java.lang.String[] args)