Package b2p.state.bitboard.bitset
Class BitSetUtils
- java.lang.Object
-
- b2p.state.bitboard.bitset.BitSetUtils
-
public class BitSetUtils extends java.lang.ObjectThis class implements utility methods for theB2PBitSetandBitSetStateclasses.- 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 B2PBitSetnewFromPositions(int[] positions)Creates aB2PBitSetwith bits in the input indexes set totrue.static B2PBitSetnewFromPositions(BitSetPosition[] positions)Creates aB2PBitSetwith bits in the input indexes set totrue.static BitSetStatenewFromServer(it.unibo.ai.didattica.competition.tablut.domain.StateTablut serverState, int turnAmt)Returns aBitSetStateinstance representing the argument state and turn number.static BitSetStatenewFromServerString(java.lang.String serverString, it.unibo.ai.didattica.competition.tablut.domain.State.Turn turn, int turnAmt)Creates aBitSetStatefrom a string representation of the game board and the corresponding player turn and turn number.static java.lang.StringtoBitString(B2PBitSet bitSet)Converts aB2PBitSetinto a printable bit stringstatic java.lang.StringtoByteString(B2PBitSet bitSet)Converts aB2PBitSetinto a printable byte string
-
-
-
Method Detail
-
newFromServer
public static BitSetState newFromServer(it.unibo.ai.didattica.competition.tablut.domain.StateTablut serverState, int turnAmt)
Returns aBitSetStateinstance representing the argument state and turn number.- Parameters:
serverState- a server state representationturnAmt- the turn in which the state takes place- Returns:
- a
BitSetStateinstance representing the state and turn - See Also:
BitSetState,StateTablut
-
newFromPositions
public static B2PBitSet newFromPositions(int[] positions)
Creates aB2PBitSetwith bits in the input indexes set totrue.- Parameters:
positions- the indexes of the bits to be set to true- Returns:
- a
B2PBitSetinstance with bits in the input indexes set totrue
-
newFromPositions
public static B2PBitSet newFromPositions(BitSetPosition[] positions)
Creates aB2PBitSetwith bits in the input indexes set totrue.- Parameters:
positions- aBitSetPositionarray representing the indexes of the bits to be set to true- Returns:
- a
B2PBitSetinstance 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 aBitSetStatefrom 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
BitSetStaterepresenting the state of the game
-
toByteString
public static java.lang.String toByteString(B2PBitSet bitSet)
Converts aB2PBitSetinto a printable byte string- Parameters:
bitSet- the bit set to stringify- Returns:
- a printable byte string
- See Also:
B2PBitSet
-
-