public class BtrpNumber extends DefaultBtrpOperand
| Modifier and Type | Class and Description |
|---|---|
static class |
BtrpNumber.Base
The number base.
|
BtrpOperand.Type| Modifier and Type | Field and Description |
|---|---|
static BtrpNumber |
FALSE
Pre-made false value.
|
static BtrpNumber |
TRUE
Pre-made true value.
|
| Constructor and Description |
|---|
BtrpNumber(double d)
Make a float number.
|
BtrpNumber(int v,
BtrpNumber.Base b)
Make a new integer.
|
| Modifier and Type | Method and Description |
|---|---|
BtrpNumber |
copy() |
int |
degree()
Get the degree of the operand.
|
BtrpNumber |
div(BtrpOperand other)
Divides this operand by another one.
|
BtrpNumber |
eq(BtrpOperand other)
Check if this operand is equals to another one.
|
boolean |
equals(Object o)
Check the equality of two elements.
|
BtrpNumber |
geq(BtrpOperand other)
Check if this operand is greater or equals to another one.
|
BtrpNumber.Base |
getBase()
Get the current base for the number
|
double |
getDoubleValue()
The real value of this operand.
|
int |
getIntValue()
The integer value of this operand.
|
BtrpNumber |
gt(BtrpOperand other)
Check if this operand is strictly greater than another one.
|
int |
hashCode() |
boolean |
isInteger()
Indicates whether or not the number is an integer.
|
BtrpNumber |
minus(BtrpOperand other)
Computes the difference between this operand and another one.
|
BtrpNumber |
negate()
Computes the negation of this operand.
|
BtrpNumber |
not()
Compute the opposite of the operand.
|
BtrpNumber |
plus(BtrpOperand other)
Computes the addition of this operand with another one.
|
BtrpNumber |
power(BtrpOperand nb)
Computes the power of this operand.
|
BtrpNumber |
remainder(BtrpOperand other)
Computes the remainder of this operand division by another one
|
BtrpNumber |
times(BtrpOperand other)
Multiply this operand by another one
|
String |
toString()
Textual representation of the integer.
|
BtrpOperand.Type |
type()
Get the type of the operand.
|
label, prettyType, prettyType, prettyType, setLabelpublic static final BtrpNumber TRUE
public static final BtrpNumber FALSE
public BtrpNumber(int v,
BtrpNumber.Base b)
v - the current valueb - the base used when printing the valuepublic BtrpNumber(double d)
d - the value.public BtrpOperand.Type type()
BtrpOperandBtrpOperand.Type.NUMBERpublic BtrpNumber.Base getBase()
public BtrpNumber power(BtrpOperand nb)
BtrpOperandpower in interface BtrpOperandpower in class DefaultBtrpOperandnb - the other value. Must be a numberpublic BtrpNumber plus(BtrpOperand other)
BtrpOperandplus in interface BtrpOperandplus in class DefaultBtrpOperandother - the other value. Must be a numberpublic BtrpNumber minus(BtrpOperand other)
BtrpOperandminus in interface BtrpOperandminus in class DefaultBtrpOperandother - the other value. Must be a numberpublic BtrpNumber negate()
BtrpOperandnegate in interface BtrpOperandnegate in class DefaultBtrpOperandpublic BtrpNumber times(BtrpOperand other)
BtrpOperandtimes in interface BtrpOperandtimes in class DefaultBtrpOperandother - the other value. Must be a numberpublic BtrpNumber div(BtrpOperand other)
BtrpOperanddiv in interface BtrpOperanddiv in class DefaultBtrpOperandother - the other value. Must be a numberpublic BtrpNumber remainder(BtrpOperand other)
BtrpOperandremainder in interface BtrpOperandremainder in class DefaultBtrpOperandother - the other value. Must be a numberpublic boolean equals(Object o)
public String toString()
public int degree()
BtrpOperand0public int getIntValue()
0 otherwisepublic double getDoubleValue()
0 otherwisepublic BtrpNumber eq(BtrpOperand other)
BtrpOperandeq in interface BtrpOperandeq in class DefaultBtrpOperandother - the operand to compare toTRUE if both operand are equals, FALSE otherwisepublic BtrpNumber geq(BtrpOperand other)
BtrpOperandgeq in interface BtrpOperandgeq in class DefaultBtrpOperandother - the operand to compare toTRUE if this operand is greater or equals, FALSE otherwisepublic BtrpNumber gt(BtrpOperand other)
BtrpOperandgt in interface BtrpOperandgt in class DefaultBtrpOperandother - the operand to compare toTRUE if this operand is strictly greater, FALSE otherwisepublic BtrpNumber not()
BtrpOperandnot in interface BtrpOperandnot in class DefaultBtrpOperandpublic BtrpNumber copy()
public boolean isInteger()
true if the number is an integer.Copyright © 2016 University of Nice-Sophia Antipolis. All Rights Reserved.