UC Berkeley Group for User Interface Research
Updated November 17, 2000

edu.berkeley.guir.lib.collection
Class SortedValueMap

java.lang.Object
  |
  +--edu.berkeley.guir.lib.collection.SortedValueMap
Direct Known Subclasses:
SortedValueNumMap

public class SortedValueMap
extends Object

A Map with any kind of uniquely named Keys with numerical Values, sorted by the values rather than by the keys. You can set whether the Map is sorted each value has a threshold max value or not, and whether the sum of the values has a threshold max value or not.

This software is distributed under the Berkeley Software License.

 Revisions:  - GUIRLib-v1.0-1.0.0, Jun 16 1997, JH
               Created class
             - GUIRLib-v1.2-1.0.0, Jun 22 2000, JH
               Touched for GUIRLib release
             - GUIRLib-v1.3-1.0.0, Aug 11 2000, JH
               Touched for GUIRLib release
             - GUIRLib-v1.4-1.0.0, Aug 31 2000, JH
               Touched for GUIRLib release
 

Since:
JDK 1.2
Version:
GUIRLib-v1.4-1.0.0, Aug 31 2000
Author:
(jasonh@cs.berkeley.edu)

Constructor Summary
SortedValueMap(Comparator newComp)
           
 
Method Summary
 void clear()
           
 boolean containsKey(Object key)
           
 boolean containsValue(Object value)
           
 Set entrySet()
           
 boolean equals(Object obj)
           
 Object get(Object obj)
           
 Object getFirstKey()
          Get the key at the beginning of the map.
 Object getFirstValue()
          Get the value at the beginning of the map.
 Object getLargestKey()
          Get the key with the largest value.
 Object getLargestValue()
          Get the largest value stored.
 Object getLastKey()
          Get the key at the end of the map.
 Object getLastValue()
          Get the value at the end of the map.
 Object getSmallestKey()
          Get the key with the smallest value.
 Object getSmallestValue()
          Get the smallest value stored.
 boolean isEmpty()
           
 Set keySet()
           
static void main(String[] argv)
           
 Object put(Object key, Object value)
           
 void putAll(Map newMap)
           
 Object remove(Object key)
           
 void setAscending(boolean flag)
          Use this BEFORE you stick in items.
static void setDefaultAscending(boolean flag)
          Set the default value for ascending or descending order.
 int size()
           
 String toString()
           
 Collection values()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SortedValueMap

public SortedValueMap(Comparator newComp)
Method Detail

setAscending

public void setAscending(boolean flag)
Use this BEFORE you stick in items.
Parameters:
flag - is true if ascending order, false if descending.

setDefaultAscending

public static void setDefaultAscending(boolean flag)
Set the default value for ascending or descending order. This is the sorting regime that new SortedNumericalMaps will use.
Parameters:
flag - is true if new SortedNumericalMaps should sort in ascending order, false if in descending order.

clear

public void clear()

containsKey

public boolean containsKey(Object key)

containsValue

public boolean containsValue(Object value)

entrySet

public Set entrySet()

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

get

public Object get(Object obj)

isEmpty

public boolean isEmpty()

keySet

public Set keySet()

put

public Object put(Object key,
                  Object value)

putAll

public void putAll(Map newMap)

remove

public Object remove(Object key)

size

public int size()

values

public Collection values()

getFirstKey

public Object getFirstKey()
Get the key at the beginning of the map.
Returns:
whatever key is at the beginning. Will have a value that is the largest or smallest value, depending on how the map is sorted.

getLastKey

public Object getLastKey()
Get the key at the end of the map.
Returns:
whatever key is at the end. Will have a value that is the largest or smallest value, depending on how the map is sorted.

getFirstValue

public Object getFirstValue()
Get the value at the beginning of the map.
Returns:
whatever value is at the beginning. Either the largest or smallest value, depending on how the map is sorted.

getLastValue

public Object getLastValue()
Get the value at the end of the map.
Returns:
whatever value is at the end. Either the largest or smallest value, depending on how the map is sorted.

getLargestKey

public Object getLargestKey()
Get the key with the largest value.
Returns:
whatever key has the largest value.

getSmallestKey

public Object getSmallestKey()
Get the key with the smallest value.
Returns:
whatever key has the smallest value.

getLargestValue

public Object getLargestValue()
Get the largest value stored.
Returns:
whatever the largest value is.

getSmallestValue

public Object getSmallestValue()
Get the smallest value stored.
Returns:
whatever the smallest value is.

toString

public String toString()
Overrides:
toString in class Object

main

public static void main(String[] argv)

Copyright Information