org.abora.white.value
Class IntegerValue

java.lang.Object
  |
  +--org.abora.white.xpp.basic.Heaper
        |
        +--org.abora.white.value.PrimValue
              |
              +--org.abora.white.value.PrimIntValue
                    |
                    +--org.abora.white.value.IntegerValue
All Implemented Interfaces:
java.lang.Comparable

public class IntegerValue
extends PrimIntValue
implements java.lang.Comparable


Constructor Summary
protected IntegerValue(java.math.BigInteger value)
          Construct a new instance with value.
protected IntegerValue(long value)
          Construct a new instance with value.
 
Method Summary
 IntegerValue abs()
           
 int actualHashForEqual()
          Defined by subclasses to produce the value returned by hashForEqual.
 boolean asBooleanVar()
          The value as a BooleanVar.
 short asInt16()
          The value as a 16 bit signed integer
 int asInt32()
          The value as a 32 bit signed integer
 long asInt64()
          The value as a 64 bit signed integer
 byte asInt8()
          The value as a 8 bit signed integer
 char asUInt16()
          Return the value as a 16 bit unsigned integer.
 long asUInt32()
          Return the value as a 32 bit unsigned integer.
 short asUInt8()
          Return the value as an 8 bit unsigned integer.
 int bitCount()
          What precision is it, in terms of the number of bits used to represent it.
 IntegerValue bitwiseAnd(IntegerValue another)
          Return the the first number bitwise and'd with the second.
 IntegerValue bitwiseOr(IntegerValue another)
          Return the the first number bitwise or'd with the second.
 IntegerValue bitwiseXor(IntegerValue another)
          Return the the first number bitwise xor'd with the second.
 int compareTo(java.lang.Object other)
           
 IntegerValue dividedBy(IntegerValue another)
          Integer divide the two numbers and return the result.
 IntegerPos integer()
           
 int intValue()
           
 boolean isEqual(Heaper other)
          Return true if the two objects are equal.
 boolean isGE(IntegerValue another)
          Return true if the first number is greater than or equal to the second number.
 boolean isGT(IntegerValue another)
          Return true if the first number is greater than the second number.
 boolean isLE(IntegerValue another)
          Return true if the first number is less than or equal to the second number.
 boolean isLT(IntegerValue another)
          Return true if the first number is less than the second number.
 boolean isZero()
           
 IntegerValue leftShift(IntegerValue another)
          Return the the first number shifted to the left by the second amount.
 long longValue()
           
static IntegerValue make(java.math.BigInteger value)
           
static IntegerValue make(long value)
           
 IntegerValue maximum(IntegerValue another)
          Return the largest of the two numbers.
 IntegerValue minimum(IntegerValue another)
          Return the smallest of the two numbers.
 IntegerValue minus(IntegerValue another)
          Return the difference two numbers.
 IntegerValue mod(IntegerValue another)
          Return the the first number modulo the second.
 IntegerValue negated()
           
static IntegerValue one()
           
 IntegerValue plus(IntegerValue another)
          Return the sum of two numbers.
 void printContentsOn(java.io.PrintWriter oo)
          Subclasses override this method to customize their printing.
 IntegerValue times(IntegerValue another)
          Multiply the two numbers and return the result.
 java.math.BigInteger toBigInteger()
           
 java.lang.String toString()
           
static IntegerValue zero()
           
 
Methods inherited from class org.abora.white.xpp.basic.Heaper
destroy, destruct, equals, hashForEqual, printOn, sendSelfTo
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

IntegerValue

protected IntegerValue(long value)
Construct a new instance with value.

Parameters:
value -

IntegerValue

protected IntegerValue(java.math.BigInteger value)
Construct a new instance with value.

Parameters:
value -
Method Detail

zero

public static IntegerValue zero()

one

public static IntegerValue one()

make

public static IntegerValue make(long value)

make

public static IntegerValue make(java.math.BigInteger value)

isEqual

public boolean isEqual(Heaper other)
Description copied from class: Heaper
Return true if the two objects are equal.

Specified by:
isEqual in class Heaper

compareTo

public int compareTo(java.lang.Object other)
Specified by:
compareTo in interface java.lang.Comparable

isGE

public boolean isGE(IntegerValue another)
Return true if the first number is greater than or equal to the second number.


isGT

public boolean isGT(IntegerValue another)
Return true if the first number is greater than the second number.


isLT

public boolean isLT(IntegerValue another)
Return true if the first number is less than the second number.


isLE

public boolean isLE(IntegerValue another)
Return true if the first number is less than or equal to the second number.


isZero

public boolean isZero()

integer

public IntegerPos integer()

intValue

public int intValue()

longValue

public long longValue()

asInt8

public byte asInt8()
The value as a 8 bit signed integer


asInt16

public short asInt16()
The value as a 16 bit signed integer


asInt32

public int asInt32()
The value as a 32 bit signed integer


asInt64

public long asInt64()
The value as a 64 bit signed integer


asBooleanVar

public boolean asBooleanVar()
The value as a BooleanVar.


asUInt32

public long asUInt32()
Return the value as a 32 bit unsigned integer.

Returns:
value as a 32 bit unsigned integer.

asUInt16

public char asUInt16()
Return the value as a 16 bit unsigned integer.

Returns:
value as a 16 bit unsigned integer.

asUInt8

public short asUInt8()
Return the value as an 8 bit unsigned integer.

Returns:
value as an 8 bit unsigned integer.

bitwiseAnd

public IntegerValue bitwiseAnd(IntegerValue another)
Return the the first number bitwise and'd with the second.


bitwiseOr

public IntegerValue bitwiseOr(IntegerValue another)
Return the the first number bitwise or'd with the second.


bitwiseXor

public IntegerValue bitwiseXor(IntegerValue another)
Return the the first number bitwise xor'd with the second.


dividedBy

public IntegerValue dividedBy(IntegerValue another)
Integer divide the two numbers and return the result. This truncates.


leftShift

public IntegerValue leftShift(IntegerValue another)
Return the the first number shifted to the left by the second amount.


maximum

public IntegerValue maximum(IntegerValue another)
Return the largest of the two numbers.


minimum

public IntegerValue minimum(IntegerValue another)
Return the smallest of the two numbers.


minus

public IntegerValue minus(IntegerValue another)
Return the difference two numbers.


mod

public IntegerValue mod(IntegerValue another)
Return the the first number modulo the second.


plus

public IntegerValue plus(IntegerValue another)
Return the sum of two numbers.


times

public IntegerValue times(IntegerValue another)
Multiply the two numbers and return the result.


bitCount

public int bitCount()
What precision is it, in terms of the number of bits used to represent it. In the interests of efficiency, this may return a number larger than that *needed* to represent it. However, the precision reported must be at least that needed to represent this number. The fact that this message is allowed to overestimate precision doesn't interfere with equality: a->isEqual(b) exactly when they represent that same real number, even if one of them happens to overestimate precision more that the other.


actualHashForEqual

public int actualHashForEqual()
Description copied from class: Heaper
Defined by subclasses to produce the value returned by hashForEqual.

Overrides:
actualHashForEqual in class Heaper

printContentsOn

public void printContentsOn(java.io.PrintWriter oo)
Description copied from class: Heaper
Subclasses override this method to customize their printing.

Overrides:
printContentsOn in class Heaper

toString

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

toBigInteger

public java.math.BigInteger toBigInteger()

abs

public IntegerValue abs()

negated

public IntegerValue negated()


Copyright © 2003 David G Jones. All Rights Reserved.
Original Udanax-Gold - Copyright © 1979-1999 Udanax.com. All rights reserved.