public class MagicsConfig extends Object
Modifier and Type | Method and Description |
---|---|
Map.Entry<Long,Byte> |
getBishopMagics(int sqrInd) |
static MagicsConfig |
getInstance() |
Map.Entry<Long,Byte> |
getRookMagics(int sqrInd) |
void |
load()
It loads the key-values from the properties file if they are not yet loaded.
|
static void |
main(String[] args) |
void |
reload()
It reloads the key-values from the properties file whether they have been loaded before or not.
|
void |
save()
It saves the key-values of the instance to the properties file.
|
void |
setBishopMagics(int sqrInd,
Map.Entry<Long,Byte> magics) |
void |
setRookMagics(int sqrInd,
Map.Entry<Long,Byte> magics) |
public static MagicsConfig getInstance()
public Map.Entry<Long,Byte> getRookMagics(int sqrInd)
sqrInd
- The square index.public void setRookMagics(int sqrInd, Map.Entry<Long,Byte> magics)
sqrInd
- The square index.magics
- A key-value pair containing the magic number and the magic shift for a rook on the specified square.public Map.Entry<Long,Byte> getBishopMagics(int sqrInd)
sqrInd
- The square index.public void setBishopMagics(int sqrInd, Map.Entry<Long,Byte> magics)
sqrInd
- The square index.magics
- A key-value pair containing the magic number and the magic shift for a bishop on the specified square.public void load() throws IOException
IOException
- If the properties file cannot be read.public void reload() throws IOException
IOException
- If the properties file cannot be read.public void save() throws IOException
IOException
- If the properties file cannot be written to.Copyright © 2020. All rights reserved.