Package org.refcodes.numerical
Interface BitwiseOperationBuilder
-
- All Superinterfaces:
org.refcodes.mixin.ValueAccessor<java.lang.Integer>
,org.refcodes.mixin.ValueAccessor.ValueBuilder<java.lang.Integer,BitwiseOperationBuilder>
,org.refcodes.mixin.ValueAccessor.ValueMutator<java.lang.Integer>
,org.refcodes.mixin.ValueAccessor.ValueProperty<java.lang.Integer>
- All Known Implementing Classes:
BitwiseOperationBuilderImpl
public interface BitwiseOperationBuilder extends org.refcodes.mixin.ValueAccessor.ValueProperty<java.lang.Integer>, org.refcodes.mixin.ValueAccessor.ValueBuilder<java.lang.Integer,BitwiseOperationBuilder>
The bitwise operation builder applies bitwise operations to a given value being set viasetValue(Integer)
or (as of the Builder-Pattern)withValue(Integer)
.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.refcodes.mixin.ValueAccessor
org.refcodes.mixin.ValueAccessor.ValueBuilder<V extends java.lang.Object,B extends org.refcodes.mixin.ValueAccessor.ValueBuilder<V,B>>, org.refcodes.mixin.ValueAccessor.ValueMutator<V extends java.lang.Object>, org.refcodes.mixin.ValueAccessor.ValueProperty<V extends java.lang.Object>
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description boolean
isMaskable(java.lang.Integer aMask)
Tests if the bits set in the mask argument are also set in the value property ("the value property is maskable with the given mask").boolean
isTrueAt(int aPosition)
Checks if is true at.BitwiseOperationBuilder
withAnd(java.lang.Integer aOperand)
Applies a bitwise AND operation to the value property with the given operand; the value is updated accordingly and the result can be retrieved with theValueAccessor.getValue()
method.BitwiseOperationBuilder
withNot()
Applies a bitwise NOT operation to the value property ; the value is updated accordingly and the result can be retrieved with theValueAccessor.getValue()
method.BitwiseOperationBuilder
withOr(java.lang.Integer aOperand)
Applies a bitwise OR operation to the value property with the given operand; the value is updated accordingly and the result can be retrieved with theValueAccessor.getValue()
method.default BitwiseOperationBuilder
withValue(java.lang.Integer aValue)
BitwiseOperationBuilder
withXor(java.lang.Integer aOperand)
Applies a bitwise XOR operation to the value property with the given operand; the value is updated accordingly and the result can be retrieved with theValueAccessor.getValue()
method.
-
-
-
Method Detail
-
withValue
default BitwiseOperationBuilder withValue(java.lang.Integer aValue)
- Specified by:
withValue
in interfaceorg.refcodes.mixin.ValueAccessor.ValueBuilder<java.lang.Integer,BitwiseOperationBuilder>
-
withAnd
BitwiseOperationBuilder withAnd(java.lang.Integer aOperand)
Applies a bitwise AND operation to the value property with the given operand; the value is updated accordingly and the result can be retrieved with theValueAccessor.getValue()
method.- Parameters:
aOperand
- The operand to be applied to the value property.- Returns:
- The
BitwiseOperationBuilder
as of the Builder-Pattern to chain multiple operations.
-
withOr
BitwiseOperationBuilder withOr(java.lang.Integer aOperand)
Applies a bitwise OR operation to the value property with the given operand; the value is updated accordingly and the result can be retrieved with theValueAccessor.getValue()
method.- Parameters:
aOperand
- The operand to be applied to the value property.- Returns:
- The
BitwiseOperationBuilder
as of the Builder-Pattern to chain multiple operations.
-
withXor
BitwiseOperationBuilder withXor(java.lang.Integer aOperand)
Applies a bitwise XOR operation to the value property with the given operand; the value is updated accordingly and the result can be retrieved with theValueAccessor.getValue()
method.- Parameters:
aOperand
- The operand to be applied to the value property.- Returns:
- The
BitwiseOperationBuilder
as of the Builder-Pattern to chain multiple operations.
-
withNot
BitwiseOperationBuilder withNot()
Applies a bitwise NOT operation to the value property ; the value is updated accordingly and the result can be retrieved with theValueAccessor.getValue()
method.- Returns:
- The
BitwiseOperationBuilder
as of the Builder-Pattern to chain multiple operations.
-
isMaskable
boolean isMaskable(java.lang.Integer aMask)
Tests if the bits set in the mask argument are also set in the value property ("the value property is maskable with the given mask"). If this is the case true is returned. Else false is returned. Additionally bits set in the value property are not considered in the result. The bit-length of the mask may not be the same as the bit-length of the value.- Parameters:
aMask
- The mask which's true bits are to be verified against the value property.- Returns:
- True in case the value property is maskable by the given mask.
-
isTrueAt
boolean isTrueAt(int aPosition)
Checks if is true at.- Parameters:
aPosition
- the position- Returns:
- true, if is true at
-
-