org.greenstone.gs3client.data
Class Pair

java.lang.Object
  extended by org.greenstone.gs3client.data.Pair

public class Pair
extends java.lang.Object

Pair is a simple utility class to represent two associated String values. For instance, a Metadata (name, value) pair to be displayed in either SearchResultsDisplay or BrowseDisplay's metanames and metavalues JLists. (These two classes can be found in org.greenstone.gs3client.) A Comparator--like the one provided by org.greenstone.gs3client.Displays' inner class MetadataComparator--is necessary to ensure that the "natural ordering" of any List of metadata Pairs will be as required. This class does not implement Comparable so that it may be used for other purposes than storing ordered Metadata pairs, which is why using an external Comparator to provide the sorting facility is more useful.

Author:
ak19

Field Summary
 java.lang.String first
          first item of the Pair
 java.lang.String second
          second item of the Pair
 
Constructor Summary
Pair(java.lang.String a, java.lang.String b)
          Constructor that creates a Pair from two String values.
 
Method Summary
static java.lang.String[] getFirst(java.util.Vector pairs)
          Given a Vector of Pairs, returns an array of all the first values of each Pair.
static java.lang.String[] getSecond(java.util.Vector pairs)
          Given a Vector of Pairs, returns an array of all the second values of each Pair.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

first

public final java.lang.String first
first item of the Pair


second

public final java.lang.String second
second item of the Pair

Constructor Detail

Pair

public Pair(java.lang.String a,
            java.lang.String b)
Constructor that creates a Pair from two String values.

Parameters:
a - - the value for the first item of the Pair
b - - the value for the second item of the Pair.
Method Detail

getFirst

public static java.lang.String[] getFirst(java.util.Vector pairs)
Given a Vector of Pairs, returns an array of all the first values of each Pair.

Returns:
all the first fields in a Vector of pairs as an array.

getSecond

public static java.lang.String[] getSecond(java.util.Vector pairs)
Given a Vector of Pairs, returns an array of all the second values of each Pair.

Returns:
all the second fields in a Vector of pairs as an array.