public class ValueBundle extends java.lang.Object implements Substitution
These values can be used to substitute variables with the same name in some Expression.
| Modifier and Type | Field and Description |
|---|---|
protected java.util.HashMap<VariableExpression,java.lang.Boolean> |
bools
Maps variable expressions to substitute
Booleans. |
protected java.util.HashMap<VariableExpression,GroupElement> |
groupElems
Maps variable expressions to substitute
GroupElements. |
protected java.util.HashMap<VariableExpression,java.math.BigInteger> |
ints
Maps variable expressions to substitute
BigIntegers. |
protected java.util.HashMap<VariableExpression,RingElement> |
ringElems
Maps variable expressions to substitute
RingElements. |
| Constructor and Description |
|---|
ValueBundle()
Initializes an empty
ValueBundle. |
ValueBundle(ValueBundle other)
Creates a copy of the given
ValueBundle. |
| Modifier and Type | Method and Description |
|---|---|
ValueBundle |
copy()
Creates a copy of this
ValueBundle. |
java.lang.Boolean |
getBoolean(VariableExpression key)
Returns the
Boolean corresponding to the given variable expression. |
GroupElement |
getGroupElement(VariableExpression key)
Returns the
GroupElement corresponding to the given variable expression. |
java.math.BigInteger |
getInteger(VariableExpression key)
Retrieves the
BigInteger corresponding to the given variable expression. |
RingElement |
getRingElement(VariableExpression key)
Returns the
RingElement corresponding to the given variable expression. |
Expression |
getSubstitution(VariableExpression variable)
Constructs a new
Expression by substituting variables in the given VariableExpression. |
Zn.ZnElement |
getZnElement(VariableExpression key)
Returns the
ZnElement corresponding to the given variable expression. |
Zp.ZpElement |
getZpElement(VariableExpression key)
Returns the
ZpElement corresponding to the given variable expression. |
void |
put(VariableExpression key,
java.math.BigInteger value)
Adds a
BigInteger with the given key to this value bundle. |
void |
put(VariableExpression key,
boolean value) |
void |
put(VariableExpression key,
GroupElement value)
Adds a
GroupElement with the given key to this value bundle. |
void |
put(VariableExpression key,
RingElement value)
Adds a
RingElement with the given key to this value bundle. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitjoin, join, joinAndIgnoreNullpointers, joinDisjoint, joinDisjointprotected java.util.HashMap<VariableExpression,GroupElement> groupElems
GroupElements.protected java.util.HashMap<VariableExpression,java.math.BigInteger> ints
BigIntegers.protected java.util.HashMap<VariableExpression,RingElement> ringElems
RingElements.protected java.util.HashMap<VariableExpression,java.lang.Boolean> bools
Booleans.public ValueBundle()
ValueBundle.public ValueBundle(ValueBundle other)
ValueBundle.
The maps used to store the algebraic elements are recreated, the elements themselves are not cloned.
public ValueBundle copy()
ValueBundle.
The maps used to store the algebraic elements are recreated, the elements themselves are not cloned.
public GroupElement getGroupElement(VariableExpression key)
GroupElement corresponding to the given variable expression.key - the variable expression to retrieve the element forpublic RingElement getRingElement(VariableExpression key)
RingElement corresponding to the given variable expression.key - the variable expression to retrieve the element forpublic Zn.ZnElement getZnElement(VariableExpression key)
ZnElement corresponding to the given variable expression.key - the variable expression to retrieve the element forpublic Zp.ZpElement getZpElement(VariableExpression key)
ZpElement corresponding to the given variable expression.key - the variable expression to retrieve the element forpublic java.lang.Boolean getBoolean(VariableExpression key)
Boolean corresponding to the given variable expression.key - the variable expression to retrieve the Boolean forpublic java.math.BigInteger getInteger(VariableExpression key)
BigInteger corresponding to the given variable expression.
If the desired integer cannot be found, the method looks for an integer-like ring element with the given key instead.
key - the variable expression to retrieve the integer forpublic void put(VariableExpression key, GroupElement value)
GroupElement with the given key to this value bundle.
If the key is used already by another element (no matter the type), that element gets removed.
key - the key to identify the group element withvalue - the group element to addpublic void put(VariableExpression key, RingElement value)
RingElement with the given key to this value bundle.
If the key is used already by another element (no matter the type), that element gets removed.
key - the key to identify the ring element withvalue - the ring element to addpublic void put(VariableExpression key, java.math.BigInteger value)
BigInteger with the given key to this value bundle.
If the key is used already by another element (no matter the type), that element gets removed.
key - the key to identify the BigInteger withvalue - the BigInteger to addpublic void put(VariableExpression key, boolean value)
public Expression getSubstitution(VariableExpression variable)
Expression by substituting variables in the given VariableExpression.
Works by, depending on the type of the VariableExpression, searching the corresponding key-value map
for the substitution with the key given by the variable's name and applying the substitution if possible.
If no such element exists, or the VariableExpression is of an unsupported subtype, null is returned.
getSubstitution in interface Substitutionvariable - the VariableExpression to substituteExpression if substitution was successful, else null