Buglet - buglet.sourceforge.org

org.buglet.util
Class HashVector

java.lang.Object
  |
  +--org.buglet.util.HashVector

public class HashVector
extends java.lang.Object

This class has properties of both Vectors and Hashtable. You have the Hashtable ability to look up values , but the ordering is the same as that for a Vector, FIFO. FIXME - needs improvement


Field Summary
 java.util.Hashtable hash
          This is the Hashtable which holds the elements for Hashtable styled lookup
 java.util.Vector vec
          This is the Vector used to hold the elements for Vector ordered retrieval.
 
Constructor Summary
HashVector()
          Constructor, initializes containers.
 
Method Summary
 boolean containsKey(java.lang.String name)
          Returns true if the HashVector contains the given key and false otherwise.
 java.util.Enumeration elements()
           
 java.lang.Object firstElement()
           
 java.lang.Object get(java.lang.String name)
          Gets an element from the HashVector by name.
 java.lang.String getName(int i)
          Gets an object from the HashVector by position, Vector get(int i) wrapper.
 java.util.Enumeration keys()
          Returns an Enumeration containing the keys in the HashVector, wrapper for Hashtable.keys() call.
static void main(java.lang.String[] args)
          Main class for testing HashVector.
 void put(java.lang.String name, java.lang.Object val)
          Add an object with the given key.
 void removeElement(java.lang.Object elem)
           
 int size()
          Returns the number of elements in the HashVector.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

vec

public java.util.Vector vec
This is the Vector used to hold the elements for Vector ordered retrieval.

hash

public java.util.Hashtable hash
This is the Hashtable which holds the elements for Hashtable styled lookup
Constructor Detail

HashVector

public HashVector()
Constructor, initializes containers.
Method Detail

put

public void put(java.lang.String name,
                java.lang.Object val)
Add an object with the given key.
Parameters:
name -  
val -  

getName

public java.lang.String getName(int i)
Gets an object from the HashVector by position, Vector get(int i) wrapper.
Parameters:
i -  

size

public int size()
Returns the number of elements in the HashVector.

get

public java.lang.Object get(java.lang.String name)
Gets an element from the HashVector by name.
Parameters:
name -  

firstElement

public java.lang.Object firstElement()

containsKey

public boolean containsKey(java.lang.String name)
Returns true if the HashVector contains the given key and false otherwise.
Parameters:
name -  

keys

public java.util.Enumeration keys()
Returns an Enumeration containing the keys in the HashVector, wrapper for Hashtable.keys() call.

removeElement

public void removeElement(java.lang.Object elem)

elements

public java.util.Enumeration elements()

main

public static void main(java.lang.String[] args)
Main class for testing HashVector.
Parameters:
args -  

Buglet - buglet.sourceforge.org

Copyright © 2001 58k.com Inc. All Rights Reserved