File size: 1,006 Bytes
ba9863e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 .literal import Literal


class Contrary:
    """
    Represents a contrary relationship between two literals.

    Attributes:
        contraried_literal (Literal): The literal that is being contraried.
        contrary_attacker (Literal): The literal that attacks the contraried literal.
    """

    def __init__(self, contraried_literal: Literal, contrary_attacker: Literal):
        self.contraried_literal: Literal = contraried_literal
        self.contrary_attacker: Literal = contrary_attacker

    def __eq__(self, other: object) -> bool:
        if not isinstance(other, Contrary):
            return False
        return (
            self.contraried_literal == other.contraried_literal
            and self.contrary_attacker == other.contrary_attacker
        )

    def __str__(self) -> str:
        return f" {str(self.contraried_literal)}\u0304 = {str(self.contrary_attacker)}"

    
    def __hash__(self) -> int:
        return hash((self.contraried_literal, self.contrary_attacker))