Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[계산기] 공희상 제출합니다. #2

Open
wants to merge 31 commits into
base: main
Choose a base branch
from

Conversation

023-dev
Copy link
Contributor

@023-dev 023-dev commented Nov 20, 2024

계산기

플로우 차트

classDiagram
    class Application {
        +main(String[] args)
    }
    class CalculatorConfig {
        -CalculatorController calculatorController
        +CalculatorConfig()
        +run()
    }
    class CalculatorController {
        -InputView inputView
        -OutputView outputView
        -CalculatorService calculatorService
        +run()
        +input() String
        -calculate(String input) int
        -result(int result)
    }
    class CalculatorService {
        -InputValidator inputValidator
        -NumberParser numberParser
        +calculator(String input) int
        -validate(String input)
        -parse(String input) List~Integer~
        -sum(List~Integer~ numbers) int
    }
    class NumberParser {
        -DelimiterValidator delimiterValidator
        -NumberValidator numberValidator
        +parse(String input) List~Integer~
        -splitTokens(String input) List~String~
        -hasCustomDelimiter(String input) boolean
        -customTokens(String input) List~String~
        -defaultTokens(String input) List~String~
        -splitByDelimiter(String input) List~String~
        -addDelimiter(String customDelimiter)
        -toNumbers(List~String~ tokens) List~Integer~
    }
    class InputValidator {
        +validate(String input)
        -isValidInput(String input) boolean
        -isDefaultDelimiter(String input) boolean
        -isCustomDelimiter(String input) boolean
    }
    class DelimiterValidator {
        +validate(String value)
    }
    class NumberValidator {
        +validate(String value)
    }
    class InputView {
        +getInput() String
    }
    class OutputView {
        +printInputPrompt()
        +printResult(int result)
    }
    class Constants {
        <<constant>>
        +String EMPTY
        +String COMMA
        +String COLON
        +String PIPE
        +String ZERO
        +String DEFAULT_DELIMITERS
        +String DEFAULT_DELIMITER_PATTERN
        +String CUSTOM_DELIMITER_PATTERN
        +String CUSTOM_DELIMITER_PARSE_PATTERN
    }
    class ErrorMessages {
        <<constant>>
        +String INVALID_EMPTY
        +String INVALID_INPUT_NULL
        +String INVALID_INPUT_FORMAT
        +String INVALID_CONTAIN_NUMBER
        +String INVALID_NUMBER
    }
    class ViewMessages {
        <<constant>>
        +String INPUT_PROMPT_MESSAGE
        +String CALCULATOR_RESULT_MESSAGE
    }

    Application --> CalculatorConfig
    CalculatorConfig --> CalculatorController
    CalculatorController --> CalculatorService
    CalculatorController --> InputView
    CalculatorController --> OutputView
    CalculatorService --> InputValidator
    CalculatorService --> NumberParser
    NumberParser --> DelimiterValidator
    NumberParser --> NumberValidator
    InputValidator --> Constants
    DelimiterValidator --> Constants
    NumberValidator --> Constants
    InputView --> Constants
    OutputView --> Constants

Loading

패키지 다이어그램

graph TD
    calculator --> common.constant
    calculator --> util.validator
    calculator --> util.parser
    calculator --> service
    calculator --> controller
    calculator --> config

    common.constant --> Constants
    util.validator --> ValidatorStrategy
    util.validator --> InputValidator
    util.validator --> DelimiterValidator
    util.validator --> NumberValidator
    util.parser --> NumberParser
    service --> CalculatorService
    controller --> CalculatorController
    config --> CalculatorConfig

    Application --> config.CalculatorConfig
    config.CalculatorConfig --> controller.CalculatorController
    controller.CalculatorController --> service.CalculatorService
    service.CalculatorService --> util.parser.NumberParser
    service.CalculatorService --> util.validator.InputValidator
    util.parser.NumberParser --> util.validator.DelimiterValidator
    util.parser.NumberParser --> util.validator.NumberValidator
    util.validator.InputValidator --> common.constant.Constants
    util.parser.NumberParser --> common.constant.Constants

Loading

클래스 다이어그램

classDiagram
direction BT
class Application {
  + main(String[]) void
  + Application() 
}
class CalculatorConfig {
  + run() void
  + CalculatorConfig() 
}
class CalculatorController {
  + run() void
  + input() String
  - calculate(String) int
  - result(int) void
  + CalculatorController(InputView, OutputView, CalculatorService) 
}
class CalculatorService {
  + calculator(String) int
  - sum(List~Integer~) int
  - parse(String) List~Integer~
  - validate(String) void
  + CalculatorService(InputValidator, NumberParser) 
}
class Constants {
  + Constants() 
}
class DelimiterValidator {
  + validate(String) void
  + DelimiterValidator() 
}
class ErrorMessages {
  + ErrorMessages() 
}
class InputValidator {
  - isValidInput(String) boolean
  + validate(String) void
  - isDefaultDelimiter(String) boolean
  - isCustomDelimiter(String) boolean
  + InputValidator() 
}
class InputView {
  + InputView() 
   String input
}
class NumberParser {
  - defaultTokens(String) List~String~
  - hasCustomDelimiter(String) boolean
  - customTokens(String) List~String~
  - addDelimiter(String) void
  - splitTokens(String) List~String~
  - splitByDelimiter(String) List~String~
  + parse(String) List~Integer~
  - toNumbers(List~String~) List~Integer~
  + NumberParser(DelimiterValidator, NumberValidator) 
}
class NumberValidator {
  + validate(String) void
  + NumberValidator() 
}
class OutputView {
  + printInputPrompt() void
  + printResult(int) void
  + OutputView() 
}
class ValidatorStrategy~T~ {
<<Interface>>
  + validate(T) void
}
class ViewMessages {
  + ViewMessages() 
}

CalculatorConfig "1" *--> "calculatorController 1" CalculatorController 
CalculatorController "1" *--> "calculatorService 1" CalculatorService 
CalculatorController "1" *--> "inputView 1" InputView 
CalculatorController "1" *--> "outputView 1" OutputView 
CalculatorService "1" *--> "inputValidator 1" InputValidator 
CalculatorService "1" *--> "numberParser 1" NumberParser 
DelimiterValidator  ..>  ValidatorStrategy~T~ 
InputValidator  ..>  ValidatorStrategy~T~ 
NumberParser "1" *--> "delimiterValidator 1" DelimiterValidator 
NumberParser "1" *--> "numberValidator 1" NumberValidator 
NumberValidator  ..>  ValidatorStrategy~T~ 
Loading

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant