Bees v0.5.0 API

bees.core
Class Pair

java.lang.Object
  |
  +--bees.core.Pair
All Implemented Interfaces:
java.lang.Cloneable

public final class Pair
extends java.lang.Object
implements java.lang.Cloneable

A Pair is used to store a simple mapping between a name and byte array value. The class also provides a number of convenience functions for converting the byte array value to a String, int, float, etc... Grouping Pairs together is done with a PairChain.

See Also:
PairChain

Constructor Summary
Pair(java.lang.String tag, byte[] value)
          Construct a Pair with the given values.
Pair(java.lang.String tag, java.lang.String value)
          Construct a Pair with the given values.
 
Method Summary
 java.lang.Object clone()
           
 boolean equals(java.lang.Object obj)
           
 java.lang.String getStringValue()
           
 java.lang.String getTag()
           
 byte[] getValue()
           
 int hashCode()
           
 void marshal(Xdr xdr)
           
 void marshal(XdrByteArray xdr)
           
 int marshalledLength()
           
 byte[] toBytes()
           
 java.lang.String toString()
           
static Pair unmarshal(Xdr xdr)
           
static Pair unmarshal(XdrByteArray xdr)
           
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Pair

public Pair(java.lang.String tag,
            byte[] value)
Construct a Pair with the given values.
Parameters:
tag - The pair name.
value - The pair value.

Pair

public Pair(java.lang.String tag,
            java.lang.String value)
Construct a Pair with the given values.
Parameters:
tag - The pair name.
value - The pair value.
Method Detail

getTag

public java.lang.String getTag()
Returns:
The pair name.

getValue

public byte[] getValue()
Returns:
The pair value.

getStringValue

public java.lang.String getStringValue()
Returns:
The pair value as a String.

marshalledLength

public int marshalledLength()
Returns:
The number of bytes needed to flatten this Pair.

marshal

public void marshal(Xdr xdr)

unmarshal

public static Pair unmarshal(Xdr xdr)

marshal

public void marshal(XdrByteArray xdr)
Parameters:
xdr - The destination for the flattened version of this Pair.

unmarshal

public static Pair unmarshal(XdrByteArray xdr)
Parameters:
xdr - The source for the flattened version of a Pair.
Returns:
A new Pair object initialized with the value in "xdr".

toBytes

public byte[] toBytes()
Returns:
A flattened version of this pair.

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

clone

public java.lang.Object clone()
Overrides:
clone in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

Bees v0.5.0 API

This documentation is Copyright (C) 2002 The University of Utah. All Rights Reserved. See the individual source files for distribution terms.
Documentation, software, and mailing lists for Bees v0.5.0 can be found at the Janos Project: http://www.cs.utah.edu/flux/janos/