xml2fol
Class MapList<T>

java.lang.Object
  extended by xml2fol.MapList<T>

public class MapList<T>
extends java.lang.Object

A utlity class that contains both a map (vector) and a list (hashtable) for a given data type. The data can be kept in one or both data structures.


Constructor Summary
MapList()
          Creates a MapList that keeps information in both Map and List and without a comparator.
MapList(boolean storeMap, boolean storeList)
          Creates a MapList that the appropriate storeMap and storeList values and without a comparator.
MapList(boolean storeMap, boolean storeList, java.util.Comparator c)
          Creates a MapList that the appropriate storeMap and storeList values and with a comparator c.
MapList(boolean storeMap, boolean storeList, java.util.Comparator c, int size)
          Creates a MapList of specified size that the appropriate storeMap and storeList values and with a comparator c.
MapList(java.util.Comparator c)
          Creates a MapList that keeps information in both Map and List and with a comparator c.
 
Method Summary
 void Add(long key, T element)
          Adds element to MapList using key
 void Add(java.lang.String key, T element)
          Adds element to MapList using key
 void Clear()
          Clears the values in the list and map
 boolean ContainsKey(long key)
          Determines if MapList contains a specified key
 boolean ContainsKey(java.lang.String key)
          Determines if MapList contains a specified key
 void CopyMapToList()
          Copies all the values in the map to the list
 int GetListSize()
          Returns the number of elements in the list
 java.lang.String GetListText()
          Return all text in the list
 int GetMapSize()
          Returns the number of elements in the map
 boolean GetStoreList()
          Returns the value of the storeList
 boolean GetStoreMap()
          Returns the value of the storeMap
 T GetUsingIndex(int index)
          Gets an element from the MapList using the key
 T GetUsingKey(long key)
          Gets an element from the MapList using the key
 T GetUsingKey(java.lang.String key)
          Gets an element from the MapList using the key
 void PrintList()
          Outputs all text in the list to the screen
 void SetStoreList(boolean saveList)
          Sets the value of the storeList
 void SetStoreMap(boolean saveMap)
          Sets the value of the storeMap
 void Sort()
          Sorts the list if a valid comparator is advailable
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MapList

public MapList()
Creates a MapList that keeps information in both Map and List and without a comparator.


MapList

public MapList(java.util.Comparator c)
Creates a MapList that keeps information in both Map and List and with a comparator c.

Parameters:
c - - the comparator

MapList

public MapList(boolean storeMap,
               boolean storeList)
Creates a MapList that the appropriate storeMap and storeList values and without a comparator.

Parameters:
storeMap - - Specifies if data should be stored in the Map
storeList - - Specifies if data should be stored in the List

MapList

public MapList(boolean storeMap,
               boolean storeList,
               java.util.Comparator c)
Creates a MapList that the appropriate storeMap and storeList values and with a comparator c.

Parameters:
storeMap - - Specifies if data should be stored in the Map
storeList - - Specifies if data should be stored in the List
c - - the comparator

MapList

public MapList(boolean storeMap,
               boolean storeList,
               java.util.Comparator c,
               int size)
Creates a MapList of specified size that the appropriate storeMap and storeList values and with a comparator c.

Parameters:
storeMap - - Specifies if data should be stored in the Map
storeList - - Specifies if data should be stored in the List
c - - the comparator
Method Detail

Add

public void Add(java.lang.String key,
                T element)
Adds element to MapList using key

Parameters:
key - - The key for the Hashtable
element - - The element to add

Add

public void Add(long key,
                T element)
Adds element to MapList using key

Parameters:
key - - The key for the Hashtable
element - - The element to add

GetUsingKey

public T GetUsingKey(java.lang.String key)
Gets an element from the MapList using the key

Parameters:
key - - The key of the element to retrieve
Returns:
- The element

GetUsingKey

public T GetUsingKey(long key)
Gets an element from the MapList using the key

Parameters:
key - - The key of the element to retrieve
Returns:
- The element

GetUsingIndex

public T GetUsingIndex(int index)
Gets an element from the MapList using the key

Parameters:
key - - The key of the element to retrieve
Returns:
- The element

ContainsKey

public boolean ContainsKey(java.lang.String key)
Determines if MapList contains a specified key

Parameters:
key - - The key of the desired element
Returns:
- true if key is in the MapList, false otherwise

ContainsKey

public boolean ContainsKey(long key)
Determines if MapList contains a specified key

Parameters:
key - - The key of the desired element
Returns:
- true if key is in the MapList, false otherwise

GetListSize

public int GetListSize()
Returns the number of elements in the list

Returns:
- the number of elements in the list

GetMapSize

public int GetMapSize()
Returns the number of elements in the map

Returns:
- the number of elements in the map

Clear

public void Clear()
Clears the values in the list and map


GetStoreMap

public boolean GetStoreMap()
Returns the value of the storeMap

Returns:
- the value of the storeMap

GetStoreList

public boolean GetStoreList()
Returns the value of the storeList

Returns:
- the value of the storeList

SetStoreMap

public void SetStoreMap(boolean saveMap)
Sets the value of the storeMap

Parameters:
- - the value of the storeMap

SetStoreList

public void SetStoreList(boolean saveList)
Sets the value of the storeList

Parameters:
- - the value of the storeList

Sort

public void Sort()
Sorts the list if a valid comparator is advailable


GetListText

public java.lang.String GetListText()
Return all text in the list

Returns:
- A string containing all the text in the list

CopyMapToList

public void CopyMapToList()
Copies all the values in the map to the list


PrintList

public void PrintList()
Outputs all text in the list to the screen