|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectgenopt.db.OrderedMap
public class OrderedMap
Object representing an ordered map, similar to HashMap, but order is preserved.
This project was carried out at:
and supported byGenOpt 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.
| 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 |
|---|
protected java.lang.Object[][] map
protected int nK
| Constructor Detail |
|---|
public OrderedMap()
| Method Detail |
|---|
public void put(java.lang.Object key,
java.lang.Object value)
key - key of the pairvalue - value of the pairprivate void increaseCapacity()
public boolean containsKey(java.lang.Object o)
true if the Object is a key in the Map,
false otherwise
o - Object to be compared against the keys
true if Object is already in Map,
false otherwisepublic boolean containsValue(java.lang.Object o)
true if the Object is a value in the Map,
false otherwise
o - Object to be compared against the values
true if Object is already in Map,
false otherwisepublic java.lang.Object[] getKeys()
public java.lang.Object[] getValues()
public java.lang.Object getValue(int i)
i-th value
i-th valuepublic java.lang.Object get(java.lang.Object key)
key - the key for which the value will be returned
public java.lang.Object setValue(int i,
java.lang.Object value)
i-th entry
i - the number of the value
i-th entrypublic int size()
public static void main(java.lang.String[] args)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||