org.omegahat.Simulation.RandomGenerators
Class Unsigned

java.lang.Object
  |
  +--org.omegahat.Simulation.RandomGenerators.Unsigned

public class Unsigned
extends java.lang.Object

Package to provide conversion from/to integer values treated as unsigned. This class is currenly incomplete. Contributions are welcome. Potential additions include:


Constructor Summary
Unsigned()
           
 
Method Summary
static double fromDouble(double d)
          Convert a double to an int (treated as unsigned) Note that in the current implementation, long negative values are converted unchanged.
static int fromLong(long l)
          Convert a long to an int (treated as unsigned) Note that in the current implementation, long negative values are converted unchanged.
static double toDouble(int i)
          Convert an int (treated as unsigned) to a double
static long toLong(int u)
          Convert an int (treated as unsigned) to a long
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Constructor Detail

Unsigned

public Unsigned()
Method Detail

toLong

public static long toLong(int u)
Convert an int (treated as unsigned) to a long

fromLong

public static int fromLong(long l)
Convert a long to an int (treated as unsigned) Note that in the current implementation, long negative values are converted unchanged. Thus, fromLong(-1L) returns -1 as does fromLong( (long) (2.0^32.0-1.0) ) .

toDouble

public static double toDouble(int i)
Convert an int (treated as unsigned) to a double

fromDouble

public static double fromDouble(double d)
Convert a double to an int (treated as unsigned) Note that in the current implementation, long negative values are converted unchanged. Thus, fromDouble(-1.0) returns -1 as does fromDouble( (2.0^32.0-1.0) ) .