File size: 1,467 Bytes
f3e5bb7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
from validators.base import Validator
from validators.code_verifier import CodeVerifier
from validators.physics_validator import PhysicsValidator
from validators.test_generator import TestGenerator
from validators.dependency_resolver import DependencyResolver
from validators.design_implementation_validator import DesignImplementationValidator

class ValidatorFactory:
    """検証クラスファクトリ"""
    
    def __init__(self, client):
        self.client = client
        self.validators = {}
    
    def get_validator(self, validator_type):
        """指定タイプの検証クラスのインスタンスを取得"""
        if validator_type not in self.validators:
            if validator_type == "code":
                self.validators[validator_type] = CodeVerifier(self.client)
            elif validator_type == "physics":
                self.validators[validator_type] = PhysicsValidator(self.client)
            elif validator_type == "test":
                self.validators[validator_type] = TestGenerator(self.client)
            elif validator_type == "dependency":
                self.validators[validator_type] = DependencyResolver(self.client)
            elif validator_type == "design":
                self.validators[validator_type] = DesignImplementationValidator(self.client)
            else:
                raise ValueError(f"Unknown validator type: {validator_type}")
        
        return self.validators[validator_type]