## com.perisic.ring Class IntegerRing

```java.lang.Object
com.perisic.ring.Ring
com.perisic.ring.IntegerRing
```

`public class IntegerRingextends Ring`

The ring of Integers. In essential this class wraps the java.math.Biginteger class.

Note that this class has no public constructor. The only public instance of this class is Ring.Z.

Example of use:

``` import com.perisic.ring.*;
import java.math.*;
class IntegerRingExample {
public static void main(String [] args) {
RingElt a = Ring.Z.map("3");
RingElt b = Ring.Z.map( new BigInteger("1000000"));
System.out.println("a = "+a);
}
}
```
writes "a = 1000003" to the output.
• Last Change: 13.12.2003: GPL, MC.
• Email: ring@perisic.com. Please let me know if you use this software.
• WWW: www.ring.perisic.com
• The com.perisic.ring library is distributed under the terms of the GNU Lesser General Public License (LGPL).
• disclaimer: The classes are provided "as is". There is no warranty implied by using the com.perisic.ring package.

Version:
0.2
Author:

Field Summary

Fields inherited from class com.perisic.ring.Ring
`C, F2, Q, R`

Method Summary
` RingElt` ```add(RingElt a, RingElt b)```
Returns the sum of the parameters.
` RingElt` ```ediv(RingElt a, RingElt b)```
Euclidian division.
` boolean` `equalZero(RingElt b)`
Returns true if b is equals to zero, false otherwise.
` RingElt` `inv(RingElt b)`
Returns b for b == 1 and b == -1.
` boolean` `isEuclidian()`
Returns true as Z is an Euclidian ring.
` RingElt` ```mod(RingElt a, RingElt b)```
Remainder of Euclidian division.
` RingElt` ```mult(RingElt a, RingElt b)```
Returns the product of the parameters.
` RingElt` `neg(RingElt b)`
Returns -b as an element of this Ring.
` RingElt` `one()`
Returns 1 as an element of this Ring.
` RingElt` ```tdiv(RingElt a, RingElt b)```
True division.
`static java.math.BigInteger` `toBigInteger(RingElt b)`
Returns the value of b as a BigInteger.
` java.lang.String` `toString()`
Returns "Z".
` RingElt` `zero()`
Returns 0 as an element of this Ring.

Methods inherited from class com.perisic.ring.Ring
`div, eltToString, equal, evaluatePolynomial, gcd, isField, isUFD, map, map, map, map, map, pow, pow, sub`

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Method Detail

### toString

`public java.lang.String toString()`
Returns "Z".

Overrides:
`toString` in class `java.lang.Object`
Returns:
"Z".

### isEuclidian

`public boolean isEuclidian()`
Returns true as Z is an Euclidian ring.

Overrides:
`isEuclidian` in class `Ring`
Returns:
true.

```public RingElt add(RingElt a,
RingElt b)```
Returns the sum of the parameters.

Specified by:
`add` in class `Ring`
Parameters:
`a` - a RingElt which can be mapped to an element of this ring.
`b` - a RingElt which can be mapped to an element of this ring.
Returns:
a + b.

### mult

```public RingElt mult(RingElt a,
RingElt b)```
Returns the product of the parameters.

Specified by:
`mult` in class `Ring`
Parameters:
`a` - a RingElt which can be mapped to an element of this ring.
`b` - a RingElt which can be mapped to an element of this ring.
Returns:
a * b.

### inv

```public RingElt inv(RingElt b)
throws RingException```
Returns b for b == 1 and b == -1. Otherwise throws a RingException.

Overrides:
`inv` in class `Ring`
Parameters:
`b` - a RingElt which can be mapped to an element of this ring.
Returns:
b^-1.
Throws:
`RingException` - if b is neither 1 or -1.

### ediv

```public RingElt ediv(RingElt a,
RingElt b)```
Euclidian division. Performs division with remainder.

Overrides:
`ediv` in class `Ring`
Parameters:
`a` - a RingElt which can be mapped to an element of this ring.
`b` - a RingElt which can be mapped to an element of this ring.
Returns:
a/b (Euclidian division).
`BigInteger.divide(java.math.BigInteger)`

### tdiv

```public RingElt tdiv(RingElt a,
RingElt b)```
True division. If the division cannot be performed without remainder a RingException is thrown.

Overrides:
`tdiv` in class `Ring`
Parameters:
`a` - a RingElt which can be mapped to an element of this ring.
`b` - a RingElt which can be mapped to an element of this ring.
Returns:
a/b if b divides a.
Throws:
`RingException` - if b divides not a.

### mod

```public RingElt mod(RingElt a,
RingElt b)```
Remainder of Euclidian division. True division. If the division cannot be performed without remainder

Overrides:
`mod` in class `Ring`
Parameters:
`a` - a RingElt which can be mapped to an element of this ring.
`b` - a RingElt which can be mapped to an element of this ring.
Returns:
a%b (remainder of Euclidian division).

### one

`public RingElt one()`
Returns 1 as an element of this Ring.

Overrides:
`one` in class `Ring`
Returns:
1.

### zero

`public RingElt zero()`
Returns 0 as an element of this Ring.

Specified by:
`zero` in class `Ring`
Returns:
0.

### neg

`public RingElt neg(RingElt b)`
Returns -b as an element of this Ring.

Specified by:
`neg` in class `Ring`
Parameters:
`b` - a RingElt which can be mapped to an element of this ring.
Returns:
-b.

### equalZero

`public boolean equalZero(RingElt b)`
Returns true if b is equals to zero, false otherwise.

Specified by:
`equalZero` in class `Ring`
Parameters:
`b` - a RingElt which can be mapped to an element of this ring.
Returns:
true if and only if b == 0.

### toBigInteger

`public static java.math.BigInteger toBigInteger(RingElt b)`
Returns the value of b as a BigInteger.

Parameters:
`b` - a RingElt which can be mapped to an element of this ring.
Returns:
b as BigInteger.