Specification pattern: Difference between revisions

Content deleted Content added
m clean up WP:TEMPLATECAT and general fixes
Line 231:
from dataclasses import dataclass
from typing import Any
 
 
class BaseSpecification:
Line 246 ⟶ 245:
def not_(self) -> "NotSpecification":
return NotSpecification(self)
 
 
@dataclass(frozen=True)
Line 255 ⟶ 253:
def is_satisfied_by(self, candidate: Any) -> bool:
return self.first.is_satisfied_by(candidate) and self.second.is_satisfied_by(candidate)
 
 
@dataclass(frozen=True)
Line 264 ⟶ 261:
def is_satisfied_by(self, candidate: Any) -> bool:
return self.first.is_satisfied_by(candidate) or self.second.is_satisfied_by(candidate)
 
 
@dataclass(frozen=True)
Line 272 ⟶ 268:
def is_satisfied_by(self, candidate: Any) -> bool:
return not self.subject.is_satisfied_by(candidate)
 
 
</source>
Line 346 ⟶ 341:
[[Category:Architectural pattern (computer science)]]
[[Category:Articles with example C Sharp code]]
[[Category:Software design patterns]]