Package mastermind.core
Class CodeFactory
java.lang.Object
mastermind.core.CodeFactory
Factory class for creating
Code objects.-
Method Summary
-
Method Details
-
fromColorIndices
Creates aCodeobject from a list of color indices.- Parameters:
indices- List of color indices.- Returns:
- A
Codeobject.
-
getRandom
Creates a randomCodeobject.- Returns:
- A random
Codeobject.
-
getRandomFromFile
Creates a randomCodeobject from a file.- Parameters:
file- File containing the codes.- Returns:
- A random
Codeobject. - Throws:
FileNotFoundException- If the file is not found.IllegalArgumentException- If the file is empty, the code length is invalid, or the color index is invalid.
-