class DependentUtils {

    public static DependResult getDependResultForRelation(DependentRelation relation,
                                                          List<DependResult> dependResultList) {

        DependResult dependResult = DependResult.SUCCESS;

        switch (relation) {
            case AND:
                if (dependResultList.contains(DependResult.FAILED)) {
                    dependResult = DependResult.FAILED;
                }
                if (dependResultList.contains(DependResult.WAITING)) {
                    dependResult = DependResult.WAITING;
                }
                break;
            case OR:
                if (dependResultList.contains(DependResult.SUCCESS)) {
                    dependResult = DependResult.SUCCESS;
                } else if (dependResultList.contains(DependResult.WAITING)) {
                    dependResult = DependResult.WAITING;
                } else {
                    dependResult = DependResult.FAILED;
                }
                break;
            default:
                break;
        }
        return dependResult;
    }

    private  DependentUtils();

}