Class GeneralValuedBitSet
java.lang.Object
org.tweetyproject.logics.translators.adfconditional.GeneralValuedBitSet
Similar to the ThreeValuedBitSet but with arbitrary values allowed
Can be used for 4-valued interpretations but also for anything above that!
- Author:
- Jonas Schumacher
-
Constructor Summary
ConstructorDescriptionGeneralValuedBitSet
(int size, int maxValue) Creates a new bitset with the specified size and all values set to 0 -
Method Summary
Modifier and TypeMethodDescriptionboolean
allTrue()
Return true, if all values are set to max valuevoid
clear
(int index) Sets the value at given position to 0int
get
(int i) get the value of the bit at position iint
increment
(int i) Increments the value at the specified position.void
set
(int i, int value) sets the value of the bit at position iint
size()
Return size
-
Constructor Details
-
GeneralValuedBitSet
public GeneralValuedBitSet(int size, int maxValue) Creates a new bitset with the specified size and all values set to 0- Parameters:
size
- the fixed size of the bitsetmaxValue
- maxValue
-
-
Method Details
-
increment
public int increment(int i) Increments the value at the specified position. If the value is already set to maxValue, it resets the current position and increments position i+1 The order of the values is 0, 1, 2, etc.- Parameters:
i
- the position- Returns:
- the new value at position i
-
get
public int get(int i) get the value of the bit at position i- Parameters:
i
- = position- Returns:
- the value of the position
-
set
public void set(int i, int value) sets the value of the bit at position i- Parameters:
i
- = positionvalue
- = value to be set
-
allTrue
public boolean allTrue()Return true, if all values are set to max value- Returns:
- true, if all values are set to max value
-
clear
public void clear(int index) Sets the value at given position to 0- Parameters:
index
- the index of the bit to clear
-
size
public int size()Return size- Returns:
- size
-