Constructor and Description |
---|
SignedAddSubInt() |
SignedAddSubInt(SignedAddSubInt a)
Copy constructor; a deep copy should be performed.
|
SignedAddSubInt(java.lang.String a)
This is a constructor that construct an AddSubInt with value presented
by the input string.
|
Modifier and Type | Method and Description |
---|---|
void |
add(BigInt b)
Add an SignedAddSubInt mx into this BigInt.
|
static SignedAddSubInt |
add(SignedAddSubInt a,
SignedAddSubInt b)
The method should not have side-effect.
|
int |
compareTo(BigInt b)
Override the default compareTo method
|
void |
subtract(BigInt b)
Students don't have to implement this method for Asg3.
|
static SignedAddSubInt |
subtract(SignedAddSubInt a,
SignedAddSubInt b) |
java.lang.String |
toString()
Override the default toString method
|
java.lang.String |
toString(int w) |
add, div, equals, times
public SignedAddSubInt()
public SignedAddSubInt(java.lang.String a)
a
- is a string such as "000123400"public SignedAddSubInt(SignedAddSubInt a)
a
- to be copiedpublic static SignedAddSubInt add(SignedAddSubInt a, SignedAddSubInt b)
a
- is AddSubIntb
- is AddSubIntpublic static SignedAddSubInt subtract(SignedAddSubInt a, SignedAddSubInt b)
public void add(BigInt b)
add
in interface BigInt
add
in class AdditionOnlyInt
b
- is a BigInt, some type casting is necessarypublic void subtract(BigInt b)
AdditionOnlyInt
public int compareTo(BigInt b)
compareTo
in interface java.lang.Comparable<BigInt>
compareTo
in class AdditionOnlyInt
b
- is expected to be a BigInt to work correctlypublic java.lang.String toString()
AdditionOnlyInt
toString
in class AdditionOnlyInt
public java.lang.String toString(int w)
w
- is the length of the returned string using right alignment