package controllers;

import dao.*;
import dao.impl.*;

/**
 * Created by Victor Dichko on 22.09.14.
 */
public class Factory {

    private static UserDAO userDAO = null;
    private static ChoiceTextDAO choiceTextDAO = null;
    private static QuestionDAO quesionDAO = null;
    private static ChoiceDAO choiceDAO = null;
    private static AnswerRecordDAO answerRecordDAO = null;
    private static RuleDAO ruleDAO = null;
    private static Factory instance = null;

    public static synchronized Factory getInstance() {
        if (instance == null) {
            instance = new Factory();
        }
        return instance;
    }

    public UserDAO getUserDAO() {
        if (userDAO == null) {
            userDAO = new UserDAOImpl();
        }
        return userDAO;
    }

    public ChoiceTextDAO getChoiceTextDAO() {
        if (choiceTextDAO == null) {
            choiceTextDAO = new ChoiceTextDAOImpl();
        }
        return choiceTextDAO;
    }

    public QuestionDAO getQuestionDAO() {
        if (quesionDAO == null) {
            quesionDAO = new QuestionDAOImpl();
        }
        return quesionDAO;
    }

    public ChoiceDAO getChoiceDAO() {
        if (choiceDAO == null) {
            choiceDAO = new ChoiceDAOImpl();
        }
        return choiceDAO;
    }

    public AnswerRecordDAO getAnswerRecordDAO() {
        if (answerRecordDAO == null) {
            answerRecordDAO = new AnswerRecordDAOImpl();
        }
        return answerRecordDAO;
    }

    public RuleDAO getRuleDAO() {
        if (ruleDAO == null) {
            ruleDAO = new RuleDAOImpl();
        }
        return ruleDAO;
    }
}

@@ -251,24 +251,25 @@
 tionDAO ques
+t
 ionDAO = nul
@@ -1016,24 +1016,25 @@
     if (ques
+t
 ionDAO == nu
@@ -1051,24 +1051,25 @@
         ques
+t
 ionDAO = new
@@ -1117,16 +1117,17 @@
 urn ques
+t
 ionDAO;%0A

Correct spelling errors