/** * Returns a {@code BigInteger} whose value is {@code this & value}. * * <p><b>Implementation Note:</b> Usage of this method is not recommended * as the current implementation is not efficient. * * @param value value to be and'ed with {@code this}. * @throws NullPointerException if {@code value == null}. */ public BigInteger and(BigInteger value) { this.prepareJavaRepresentation(); value.prepareJavaRepresentation(); return Logical.and(this, value); }
/** @see BigInteger#and(BigInteger) */ static BigInteger and(BigInteger val, BigInteger that) { if (that.sign == 0 || val.sign == 0) { return BigInteger.ZERO; } if (that.equals(BigInteger.MINUS_ONE)){ return val; } if (val.equals(BigInteger.MINUS_ONE)) { return that; } if (val.sign > 0) { if (that.sign > 0) { return andPositive(val, that); } else { return andDiffSigns(val, that); } } else { if (that.sign > 0) { return andDiffSigns(that, val); } else if (val.numberLength > that.numberLength) { return andNegative(val, that); } else { return andNegative(that, val); } } }
/** * Returns a {@code BigInteger} whose value is {@code this & ~value}. * Evaluating {@code x.andNot(value)} returns the same result as {@code * x.and(value.not())}. * * <p><b>Implementation Note:</b> Usage of this method is not recommended * as the current implementation is not efficient. * * @param value value to be not'ed and then and'ed with {@code this}. * @throws NullPointerException if {@code value == null}. */ public BigInteger andNot(BigInteger value) { this.prepareJavaRepresentation(); value.prepareJavaRepresentation(); return Logical.andNot(this, value); }
/** @see BigInteger#andNot(BigInteger) */ static BigInteger andNot(BigInteger val, BigInteger that) { if (that.sign == 0 ) { return val; } if (val.sign == 0) { return BigInteger.ZERO; } if (val.equals(BigInteger.MINUS_ONE)) { return that.not(); } if (that.equals(BigInteger.MINUS_ONE)){ return BigInteger.ZERO; } //if val == that, return 0 if (val.sign > 0) { if (that.sign > 0) { return andNotPositive(val, that); } else { return andNotPositiveNegative(val, that); } } else { if (that.sign > 0) { return andNotNegativePositive(val, that); } else { return andNotNegative(val, that); } } }
/** * Returns a {@code BigInteger} whose value is {@code ~this}. The result * of this operation is {@code -this-1}. * * <p><b>Implementation Note:</b> Usage of this method is not recommended as * the current implementation is not efficient. */ public BigInteger not() { this.prepareJavaRepresentation(); return Logical.not(this); }
/** @see BigInteger#andNot(BigInteger) */ static BigInteger andNot(BigInteger val, BigInteger that) { if (that.sign == 0 ) { return val; } if (val.sign == 0) { return BigInteger.ZERO; } if (val.equals(BigInteger.MINUS_ONE)) { return that.not(); } if (that.equals(BigInteger.MINUS_ONE)){ return BigInteger.ZERO; } //if val == that, return 0 if (val.sign > 0) { if (that.sign > 0) { return andNotPositive(val, that); } else { return andNotPositiveNegative(val, that); } } else { if (that.sign > 0) { return andNotNegativePositive(val, that); } else { return andNotNegative(val, that); } } }
/** * Returns a {@code BigInteger} whose value is {@code ~this}. The result * of this operation is {@code -this-1}. * * <p><b>Implementation Note:</b> Usage of this method is not recommended as * the current implementation is not efficient. */ public BigInteger not() { this.prepareJavaRepresentation(); return Logical.not(this); }
/** @see BigInteger#andNot(BigInteger) */ static BigInteger andNot(BigInteger val, BigInteger that) { if (that.sign == 0 ) { return val; } if (val.sign == 0) { return BigInteger.ZERO; } if (val.equals(BigInteger.MINUS_ONE)) { return that.not(); } if (that.equals(BigInteger.MINUS_ONE)){ return BigInteger.ZERO; } //if val == that, return 0 if (val.sign > 0) { if (that.sign > 0) { return andNotPositive(val, that); } else { return andNotPositiveNegative(val, that); } } else { if (that.sign > 0) { return andNotNegativePositive(val, that); } else { return andNotNegative(val, that); } } }
/** @see BigInteger#and(BigInteger) */ static BigInteger and(BigInteger val, BigInteger that) { if (that.sign == 0 || val.sign == 0) { return BigInteger.ZERO; } if (that.equals(BigInteger.MINUS_ONE)){ return val; } if (val.equals(BigInteger.MINUS_ONE)) { return that; } if (val.sign > 0) { if (that.sign > 0) { return andPositive(val, that); } else { return andDiffSigns(val, that); } } else { if (that.sign > 0) { return andDiffSigns(that, val); } else if (val.numberLength > that.numberLength) { return andNegative(val, that); } else { return andNegative(that, val); } } }
/** * Returns a {@code BigInteger} whose value is {@code ~this}. The result * of this operation is {@code -this-1}. * * <p><b>Implementation Note:</b> Usage of this method is not recommended as * the current implementation is not efficient. */ public BigInteger not() { this.prepareJavaRepresentation(); return Logical.not(this); }
/** * Returns a {@code BigInteger} whose value is {@code this & value}. * * <p><b>Implementation Note:</b> Usage of this method is not recommended * as the current implementation is not efficient. * * @param value value to be and'ed with {@code this}. * @throws NullPointerException if {@code value == null}. */ public BigInteger and(BigInteger value) { this.prepareJavaRepresentation(); value.prepareJavaRepresentation(); return Logical.and(this, value); }
/** * Returns a {@code BigInteger} whose value is {@code this & ~value}. * Evaluating {@code x.andNot(value)} returns the same result as {@code * x.and(value.not())}. * * <p><b>Implementation Note:</b> Usage of this method is not recommended * as the current implementation is not efficient. * * @param value value to be not'ed and then and'ed with {@code this}. * @throws NullPointerException if {@code value == null}. */ public BigInteger andNot(BigInteger value) { this.prepareJavaRepresentation(); value.prepareJavaRepresentation(); return Logical.andNot(this, value); }
/** @see BigInteger#andNot(BigInteger) */ static BigInteger andNot(BigInteger val, BigInteger that) { if (that.sign == 0 ) { return val; } if (val.sign == 0) { return BigInteger.ZERO; } if (val.equals(BigInteger.MINUS_ONE)) { return that.not(); } if (that.equals(BigInteger.MINUS_ONE)){ return BigInteger.ZERO; } //if val == that, return 0 if (val.sign > 0) { if (that.sign > 0) { return andNotPositive(val, that); } else { return andNotPositiveNegative(val, that); } } else { if (that.sign > 0) { return andNotNegativePositive(val, that); } else { return andNotNegative(val, that); } } }
/** @see BigInteger#and(BigInteger) */ static BigInteger and(BigInteger val, BigInteger that) { if (that.sign == 0 || val.sign == 0) { return BigInteger.ZERO; } if (that.equals(BigInteger.MINUS_ONE)){ return val; } if (val.equals(BigInteger.MINUS_ONE)) { return that; } if (val.sign > 0) { if (that.sign > 0) { return andPositive(val, that); } else { return andDiffSigns(val, that); } } else { if (that.sign > 0) { return andDiffSigns(that, val); } else if (val.numberLength > that.numberLength) { return andNegative(val, that); } else { return andNegative(that, val); } } }
/** * Returns a {@code BigInteger} whose value is {@code ~this}. The result * of this operation is {@code -this-1}. * * <p><b>Implementation Note:</b> Usage of this method is not recommended as * the current implementation is not efficient. */ public BigInteger not() { this.prepareJavaRepresentation(); return Logical.not(this); }
/** * Returns a {@code BigInteger} whose value is {@code this & value}. * * <p><b>Implementation Note:</b> Usage of this method is not recommended * as the current implementation is not efficient. * * @param value value to be and'ed with {@code this}. * @throws NullPointerException if {@code value == null}. */ public BigInteger and(BigInteger value) { this.prepareJavaRepresentation(); value.prepareJavaRepresentation(); return Logical.and(this, value); }
/** * Returns a {@code BigInteger} whose value is {@code this & ~value}. * Evaluating {@code x.andNot(value)} returns the same result as {@code * x.and(value.not())}. * * <p><b>Implementation Note:</b> Usage of this method is not recommended * as the current implementation is not efficient. * * @param value value to be not'ed and then and'ed with {@code this}. * @throws NullPointerException if {@code value == null}. */ public BigInteger andNot(BigInteger value) { this.prepareJavaRepresentation(); value.prepareJavaRepresentation(); return Logical.andNot(this, value); }
/** @see BigInteger#andNot(BigInteger) */ static BigInteger andNot(BigInteger val, BigInteger that) { if (that.sign == 0 ) { return val; } if (val.sign == 0) { return BigInteger.ZERO; } if (val.equals(BigInteger.MINUS_ONE)) { return that.not(); } if (that.equals(BigInteger.MINUS_ONE)){ return BigInteger.ZERO; } //if val == that, return 0 if (val.sign > 0) { if (that.sign > 0) { return andNotPositive(val, that); } else { return andNotPositiveNegative(val, that); } } else { if (that.sign > 0) { return andNotNegativePositive(val, that); } else { return andNotNegative(val, that); } } }
/** @see BigInteger#and(BigInteger) */ static BigInteger and(BigInteger val, BigInteger that) { if (that.sign == 0 || val.sign == 0) { return BigInteger.ZERO; } if (that.equals(BigInteger.MINUS_ONE)){ return val; } if (val.equals(BigInteger.MINUS_ONE)) { return that; } if (val.sign > 0) { if (that.sign > 0) { return andPositive(val, that); } else { return andDiffSigns(val, that); } } else { if (that.sign > 0) { return andDiffSigns(that, val); } else if (val.numberLength > that.numberLength) { return andNegative(val, that); } else { return andNegative(that, val); } } }
/** * Returns a {@code BigInteger} whose value is {@code ~this}. The result * of this operation is {@code -this-1}. * * <p><b>Implementation Note:</b> Usage of this method is not recommended as * the current implementation is not efficient. */ public BigInteger not() { this.prepareJavaRepresentation(); return Logical.not(this); }