public class IntegerElement extends java.lang.Object implements RingElement
IntegerRing).| Constructor and Description |
|---|
IntegerElement(java.math.BigInteger v) |
IntegerElement(long v) |
| Modifier and Type | Method and Description |
|---|---|
IntegerElement |
add(Element e)
Computes \(\text{this} + e\).
|
java.math.BigInteger |
asInteger()
Interprets this element as an integer.
|
boolean |
divides(RingElement e)
Returns true iff there exists an \(x\) in the ring such that \(\text{this} \cdot x = e\).
|
IntegerElement[] |
divideWithRemainder(RingElement e)
Divides this by e with remainder, returning both quotient and remainder.
|
boolean |
equals(java.lang.Object o) |
java.math.BigInteger |
getBigInt()
Returns the
BigInteger underlying this element. |
java.math.BigInteger |
getRank()
Implements the euclidean function of a euclidean domain.
|
Representation |
getRepresentation()
The representation of this object.
|
Ring |
getStructure()
Returns the
Structure that this Element belongs to. |
int |
hashCode() |
IntegerElement |
inv()
Computes the multiplicative inverse of this element.
|
IntegerElement |
mul(java.math.BigInteger k)
Computes \(\text{this} \cdot k\) (equivalent to \(\text{this} + \text{this} + \cdots\) k-times).
|
IntegerElement |
mul(Element e)
Computes \(\text{this} \cdot e\).
|
IntegerElement |
neg()
Computes the additive inverse of this element.
|
java.lang.String |
toString() |
ByteAccumulator |
updateAccumulator(ByteAccumulator accumulator)
Updates the ByteAccumulator with the unique byte representation of this object.
|
clone, finalize, getClass, notify, notifyAll, wait, wait, waitdiv, isOne, isUnit, isZero, mul, pow, pow, square, sub, toAdditiveGroupElement, toUnitGroupElementgetUniqueByteRepresentationpublic IntegerElement(java.math.BigInteger v)
public IntegerElement(long v)
public Representation getRepresentation()
RepresentableReprUtilgetRepresentation in interface RepresentableRepresentationpublic java.math.BigInteger getBigInt()
BigInteger underlying this element.public Ring getStructure()
ElementStructure that this Element belongs to.getStructure in interface ElementgetStructure in interface RingElementpublic IntegerElement add(Element e)
RingElementadd in interface RingElemente - the addendpublic IntegerElement neg()
RingElementneg in interface RingElementpublic IntegerElement mul(Element e)
RingElementmul in interface RingElemente - the factorpublic IntegerElement mul(java.math.BigInteger k)
RingElementmul in interface RingElementk - the factorpublic IntegerElement inv() throws java.lang.UnsupportedOperationException
RingElementinv in interface RingElementjava.lang.UnsupportedOperationException - if this is not a unitpublic boolean divides(RingElement e) throws java.lang.UnsupportedOperationException
RingElementdivides in interface RingElementjava.lang.UnsupportedOperationException - if this cannot be decided (efficiently)public IntegerElement[] divideWithRemainder(RingElement e) throws java.lang.UnsupportedOperationException, java.lang.IllegalArgumentException
RingElement
Specifically, returns an array result such that the first entry contains the quotient
and the second entry the remainder.
Furthermore, result[1].getRank() < e.getRank() or result[1] = 0.
This definition implies that the remainder is zero if and only if e divides this element.
divideWithRemainder in interface RingElementjava.lang.UnsupportedOperationException - if the ring is not a euclidean domainjava.lang.IllegalArgumentException - if e is zeropublic java.math.BigInteger getRank()
throws java.lang.UnsupportedOperationException
RingElementThe euclidean function is a function from \(R \setminus \{0\}\) to \(\mathbb{N}_0\) such that
a.getRank() >= 0 for any a in the ring
a.mul(b).getRank() >= a.getRank() for any a, b != 0
divideWithRemainder is less than the divisor's rank
The rank of the zero element is undefined (no guarantee as to what this method returns in that case).
getRank in interface RingElementjava.lang.UnsupportedOperationException - if the ring is not a euclidean domainpublic boolean equals(java.lang.Object o)
public int hashCode()
public java.lang.String toString()
toString in class java.lang.Objectpublic ByteAccumulator updateAccumulator(ByteAccumulator accumulator)
UniqueByteRepresentableThe input to the accumulators update function is an injective (with respect to a given domain) byte encoding of this object.
For many use-cases, the AnnotatedUbrUtil can be used to quickly implement this method.
updateAccumulator in interface UniqueByteRepresentablepublic java.math.BigInteger asInteger()
throws java.lang.UnsupportedOperationException
RingElement
Formally, this method shall return the inverse of Ring.getElement(BigInteger), i.e.
x.getStructure().getElement(x.asInteger()).equals(x) (if asInteger() doesn't throw an exception).
asInteger in interface RingElementjava.lang.UnsupportedOperationException - if no such element exists or cannot be efficiently computed