bamboo.util
Class GuidTools

java.lang.Object
  extended by bamboo.util.GuidTools

public class GuidTools
extends Object

GuidTools.

Version:
$Id: GuidTools.java,v 1.16 2003/12/20 02:44:19 srhea Exp $
Author:
Sean C. Rhea

Constructor Summary
GuidTools()
           
 
Method Summary
static ostore.util.SecureHash big_integer_to_secure_hash(BigInteger i)
           
static BigInteger calc_dist(BigInteger a, BigInteger b, BigInteger mod)
           
protected static void check_bpd_and_dv(int bits_per_digit, int digit_values)
           
static BigInteger digits_to_guid(int[] digits, int bits_per_digit, int digits_per_guid, int digit_values)
           
static int[] guid_to_digits(BigInteger guid, int bits_per_digit, int digits_per_guid, int digit_values)
          Convert a big integer to an array of digits_per_guid integers, one for each digit of the the big integer.
static String guid_to_string(BigInteger i)
          Print only the high-order 8 hexedecimal digits.
static boolean in_range_mod(BigInteger low, BigInteger high, BigInteger query, BigInteger mod)
           
static void main(String[] args)
          A test harness for digits_to_guid and guid_to_digits.
static BigInteger random_guid(Random rand)
           
static BigInteger secure_hash_to_big_integer(ostore.util.SecureHash x)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GuidTools

public GuidTools()
Method Detail

random_guid

public static BigInteger random_guid(Random rand)

guid_to_string

public static String guid_to_string(BigInteger i)
Print only the high-order 8 hexedecimal digits.


secure_hash_to_big_integer

public static BigInteger secure_hash_to_big_integer(ostore.util.SecureHash x)

big_integer_to_secure_hash

public static ostore.util.SecureHash big_integer_to_secure_hash(BigInteger i)

check_bpd_and_dv

protected static void check_bpd_and_dv(int bits_per_digit,
                                       int digit_values)

guid_to_digits

public static int[] guid_to_digits(BigInteger guid,
                                   int bits_per_digit,
                                   int digits_per_guid,
                                   int digit_values)
Convert a big integer to an array of digits_per_guid integers, one for each digit of the the big integer. This function was mostly cribbed from ostore.tapestry.impl.RoutingTable.digits, which I think was originally written by Jeremy Stribling.


digits_to_guid

public static BigInteger digits_to_guid(int[] digits,
                                        int bits_per_digit,
                                        int digits_per_guid,
                                        int digit_values)

calc_dist

public static BigInteger calc_dist(BigInteger a,
                                   BigInteger b,
                                   BigInteger mod)

in_range_mod

public static boolean in_range_mod(BigInteger low,
                                   BigInteger high,
                                   BigInteger query,
                                   BigInteger mod)

main

public static void main(String[] args)
A test harness for digits_to_guid and guid_to_digits.