Package utils
Class AvailabilityChecker
java.lang.Object
utils.AvailabilityChecker
This class is used to check the availability of the python environment and the eye-tracking device, and to get the eye tracker name and the available frequencies.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleancheckEyeTracker(String pythonInterpreter) Check the availability of the eye-tracking device.static booleancheckPythonEnvironment(String pythonInterpreter) Check the availability of the python environment, i.e., whether the required python packages are installed.static StringgetEyeTrackerName(String pythonInterpreter) Get the name of the eye-tracking device.getFrequencies(String pythonInterpreter) Get the available frequencies of the eye-tracking device.private static StringrunPythonScript(String pythonInterpreter, String pythonScript) Run a python script withProcessBuilderand useBufferedReaderto get the first line of the output.
-
Constructor Details
-
AvailabilityChecker
public AvailabilityChecker()
-
-
Method Details
-
checkPythonEnvironment
public static boolean checkPythonEnvironment(String pythonInterpreter) throws IOException, InterruptedException Check the availability of the python environment, i.e., whether the required python packages are installed.- Parameters:
pythonInterpreter- The path of the python interpreter.- Returns:
trueif the python environment is available,falseotherwise.- Throws:
IOExceptionInterruptedException
-
checkEyeTracker
public static boolean checkEyeTracker(String pythonInterpreter) throws IOException, InterruptedException Check the availability of the eye-tracking device.- Parameters:
pythonInterpreter- The path of the python interpreter.- Returns:
trueif the eye-tracking device is available,falseotherwise.- Throws:
IOExceptionInterruptedException
-
getEyeTrackerName
public static String getEyeTrackerName(String pythonInterpreter) throws IOException, InterruptedException Get the name of the eye-tracking device.- Parameters:
pythonInterpreter- The path of the python interpreter.- Returns:
- The name of the eye tracker.
- Throws:
IOExceptionInterruptedException
-
getFrequencies
public static List<String> getFrequencies(String pythonInterpreter) throws IOException, InterruptedException Get the available frequencies of the eye-tracking device.- Parameters:
pythonInterpreter- The path of the python interpreter.- Returns:
- The available frequencies of the eye tracker.
- Throws:
IOExceptionInterruptedException
-
runPythonScript
private static String runPythonScript(String pythonInterpreter, String pythonScript) throws IOException, InterruptedException Run a python script withProcessBuilderand useBufferedReaderto get the first line of the output.- Parameters:
pythonInterpreter- The path of the python interpreter.pythonScript- The python script to run.- Returns:
- The first line of the output.
- Throws:
IOExceptionInterruptedException
-