package com.pdaaphm.biz.factory;

import com.pdaaphm.biz.domain.AlgorithmSubType;
import com.pdaaphm.biz.service.RunAlgorithmService;
import com.pdaaphm.biz.service.impl.RunMatlabImpl;
import com.pdaaphm.biz.service.impl.RunPythonImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class AlgorithmFactory {
    @Autowired
    private RunMatlabImpl runMatlabImpl;
    @Autowired
    private RunPythonImpl runPythonImpl;

    public RunAlgorithmService createRun(String type) {
        if (AlgorithmSubType.pythonCode.equals(type)) {
            return runPythonImpl;
        } else if (AlgorithmSubType.matlabCode.equals(type)) {
            return runMatlabImpl;
        } else {
            return null;
        }
    }
}
