Package b2p.state.bitboard.bitset
Class BitSetUtils
- java.lang.Object
-
- b2p.state.bitboard.bitset.BitSetUtils
-
public class BitSetUtils extends java.lang.Object
This class implements utility methods for theB2PBitSet
andBitSetState
classes.- Author:
- Alessandro Buldini, Alessandro Pomponio, Federico Zanini
-
-
Constructor Summary
Constructors Constructor Description BitSetUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static B2PBitSet
newFromPositions(int[] positions)
Creates aB2PBitSet
with bits in the input indexes set totrue
.static B2PBitSet
newFromPositions(BitSetPosition[] positions)
Creates aB2PBitSet
with bits in the input indexes set totrue
.static BitSetState
newFromServer(it.unibo.ai.didattica.competition.tablut.domain.StateTablut serverState, int turnAmt)
Returns aBitSetState
instance representing the argument state and turn number.static BitSetState
newFromServerString(java.lang.String serverString, it.unibo.ai.didattica.competition.tablut.domain.State.Turn turn, int turnAmt)
Creates aBitSetState
from a string representation of the game board and the corresponding player turn and turn number.static java.lang.String
toBitString(B2PBitSet bitSet)
Converts aB2PBitSet
into a printable bit stringstatic java.lang.String
toByteString(B2PBitSet bitSet)
Converts aB2PBitSet
into a printable byte string
-
-
-
Method Detail
-
newFromServer
public static BitSetState newFromServer(it.unibo.ai.didattica.competition.tablut.domain.StateTablut serverState, int turnAmt)
Returns aBitSetState
instance representing the argument state and turn number.- Parameters:
serverState
- a server state representationturnAmt
- the turn in which the state takes place- Returns:
- a
BitSetState
instance representing the state and turn - See Also:
BitSetState
,StateTablut
-
newFromPositions
public static B2PBitSet newFromPositions(int[] positions)
Creates aB2PBitSet
with bits in the input indexes set totrue
.- Parameters:
positions
- the indexes of the bits to be set to true- Returns:
- a
B2PBitSet
instance with bits in the input indexes set totrue
-
newFromPositions
public static B2PBitSet newFromPositions(BitSetPosition[] positions)
Creates aB2PBitSet
with bits in the input indexes set totrue
.- Parameters:
positions
- aBitSetPosition
array representing the indexes of the bits to be set to true- Returns:
- a
B2PBitSet
instance with bits in the input indexes set totrue
-
newFromServerString
public static BitSetState newFromServerString(java.lang.String serverString, it.unibo.ai.didattica.competition.tablut.domain.State.Turn turn, int turnAmt)
Creates aBitSetState
from a string representation of the game board and the corresponding player turn and turn number.- Parameters:
serverString
- a string representation of the server stateturn
- the current playerturnAmt
- the turn number- Returns:
- a
BitSetState
representing the state of the game
-
toByteString
public static java.lang.String toByteString(B2PBitSet bitSet)
Converts aB2PBitSet
into a printable byte string- Parameters:
bitSet
- the bit set to stringify- Returns:
- a printable byte string
- See Also:
B2PBitSet
-
-