```mermaid sequenceDiagram participant クライアント participant 延滞請求書仕様 participant 請求書リポジトリ participant DBインターフェース クライアント ->>+ 延滞請求書仕様 : 生成 クライアント ->>+ 請求書リポジトリ : selectSatisfying(仕様) 請求書リポジトリ ->>+ 延滞請求書仕様 : satisfyingElementsFrom(請求書リポジトリ) 延滞請求書仕様 ->>+ 請求書リポジトリ : selectWhereDueDateIsBefore(currentDate) 請求書リポジトリ ->>+ 請求書リポジトリ : whereDueDateIsBefore_SQL(currentDate) 請求書リポジトリ ->>+ DBインターフェース : SQL文 DBインターフェース ->>+ 請求書リポジトリ : 結果セット 請求書リポジトリ -->>+ 延滞請求書仕様 : 請求書のコレクション 延滞請求書仕様 ->>+ 延滞請求書仕様 : isSatisfiedBy(請求書) 延滞請求書仕様 -->>+ 請求書リポジトリ : 請求書のコレクション 請求書リポジトリ -->>+ クライアント : 請求書のコレクション ``` ```python class 延滞請求書仕様(仕様): def satisfyingElementsFrom(self, repos: 請求書リポジトリ) -> list[請求書]: invoices = repos.selectWhereDueDateIsBefore(延滞の日付) for i, invoice in enumerate(invoices): if not self.isSatisfiedBy(invoice): del invoices[i] return invoices def isSatisfiedBy(self, invoice: 請求書) -> bool: pass class 請求書リポジトリ: def __init__(self): self.driver = ... self.invoice_factory = ... def selectSatisfying(self, spec: 仕様) -> list[請求書]: return spec.satisfyingElementsFrom(self) def selectWhereDueDateIsBefore(self, date) -> list[請求書]: sql = self.whereDueDateIsBefore_SQL(date) res = self.driver.execute(sql) return [self.invoice_factory.build_from_record(r) for r in res] def whereDueDateIsBefore_SQL(self, date) -> str: return "SQL" ```
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up