Paran-Yu / mulyuchiryo

3 stars 0 forks source link

Class 정의 수정 #27

Closed Paran-Yu closed 2 years ago

Paran-Yu commented 2 years ago

In GitLab by @dycho96 on Nov 9, 2021, 14:34

Class 선언 중 아래와 같은 이유로 수정이 필요해서 작성합니다. \ 현재 코드 내에서 클래스를 이용하고 있는 부분이 없다면 구조를 바꾸고 싶은데 괜찮을까요?

Node를 상속받는 두 클래스의 생성자에서 요구하는 변수가 부족합니다. \ 현재 UI에서는 마우스의 포인터 위치 기준으로 클래스를 생성합니다. \ 그렇기 때문에 PortWaitPoint클래스에서도 x와 y좌표가 필요한데

class Port(Node):
    def __init__(self, name):
        ...

class WaitPoint(Node):
    def __init__(self, name):
        ...

위 두 클래스는 Node를 상속받지만, Node의 생성자에서 요구하는 name_input, x, y 변수를 입력받지 않습니다.

그래서 아래와 같이 수정하고 싶습니다.

class Port(Node):
    def __init__(self, name_input, x_input, y_input, name):
        # 부모 생성자 호출
        super().__init__(name_input, x_input, y_input)
        self.PORT_NAME = name
        ...

class WaitPoint(Node):
    def __init__(self, name_input, x_input, y_input, name):
        # 부모 생성자 호출
        super().__init__(name_input, x_input, y_input)
        self.WAIT_NAME = name
        ...

그리고 두번째로

node를 name 대신 number로 관리하도록 수정했습니다

Node 생성자에서 name_inputNUMBER 형으로 사용되는걸로 보아 ID 역할을 하는것으로 보이는데, \ name이라는 이름이 PortWP의 name과 비슷해서 의미가 모호하니 num이나 id로 변경하는게 어떨까요?

def __init__(self, name_input, x_input, y_input): -> def __init__(self, num, x_input, y_input):

Paran-Yu commented 2 years ago

In GitLab by @h_nuls55 on Nov 9, 2021, 14:38

Paran-Yu commented 2 years ago

In GitLab by @tyl1996 on Nov 9, 2021, 14:43

Paran-Yu commented 2 years ago

In GitLab by @h_nuls55 on Nov 9, 2021, 15:31

mentioned in merge request !53