public class BooleanElement extends java.lang.Object implements RingElement
BooleanStructure.| Modifier and Type | Field and Description |
|---|---|
static BooleanElement |
FALSE
The
BooleanElement corresponding to a false value. |
static BooleanElement |
TRUE
The
BooleanElement corresponding to a true value. |
protected boolean |
value
The Boolean value represented by this
BooleanElement. |
| Constructor and Description |
|---|
BooleanElement(boolean value) |
BooleanElement(Representation repr) |
| Modifier and Type | Method and Description |
|---|---|
RingElement |
add(Element e)
Returns result of calling Boolean XOR on this value and the argument.
|
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\).
|
RingElement[] |
divideWithRemainder(RingElement e)
Divides this by e with remainder, returning both quotient and remainder.
|
boolean |
equals(java.lang.Object obj) |
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() |
RingElement |
inv()
If this value is
TRUE, returns TRUE; otherwise throws a UnsupportedOperationException. |
RingElement |
mul(Element e)
Returns result of calling Boolean AND on this value and the argument.
|
RingElement |
neg()
Negates this Boolean value.
|
BooleanElement |
or(Element e)
Returns result of calling Boolean OR on this value and the argument.
|
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, mul, pow, pow, square, sub, toAdditiveGroupElement, toUnitGroupElementgetUniqueByteRepresentationprotected boolean value
BooleanElement.public static BooleanElement TRUE
BooleanElement corresponding to a true value.public static BooleanElement FALSE
BooleanElement corresponding to a false value.public BooleanElement(boolean value)
public BooleanElement(Representation repr)
public Ring getStructure()
ElementStructure that this Element belongs to.getStructure in interface ElementgetStructure in interface RingElementpublic RingElement add(Element e)
add in interface RingElemente - the addendpublic RingElement neg()
neg in interface RingElementTRUE if this value is FALSE, else FALSEpublic RingElement mul(Element e)
mul in interface RingElemente - the factorpublic RingElement inv() throws java.lang.UnsupportedOperationException
TRUE, returns TRUE; otherwise throws a UnsupportedOperationException.
FALSE is the zero element and therefore has no multiplicative inversion.
inv in interface RingElementjava.lang.UnsupportedOperationException - if this value is FALSEpublic BooleanElement or(Element e)
public boolean divides(RingElement e) throws java.lang.UnsupportedOperationException
RingElementdivides in interface RingElementjava.lang.UnsupportedOperationException - if this cannot be decided (efficiently)public RingElement[] 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 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 int hashCode()
public boolean equals(java.lang.Object obj)
public java.lang.String toString()
toString in class java.lang.Objectpublic Representation getRepresentation()
RepresentableReprUtilgetRepresentation in interface RepresentableRepresentationpublic 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