# -*- coding: utf-8 -*-
"""
Module defining the state graph.
"""

# CONST
from quantities import Quantity, FrozenQuantity


class StateGraph:
    # has:
    # states
    # transitions

    # Algorithm that generates new states

    # transition rules ("things that create a new state")
    #  - dependencies (I+, I-, ...)
    #  - implications (M:0, D:+ -> M:+, D:+)
    #  - influence (turn up / down tap)
    pass


class State:
    # Contains:
    # Tap
        # Quantities
            # Inflow
    # Drain
        # Quantities
            # Outflow
    # Sink
        # Quantities
            # Volume
    pass


class Entity:
    # has:
        # quantities
        # dependencies
    pass



@@ -89,16 +89,33 @@
 s import
+ QUANTITY_SPACES,
  Quantit
@@ -133,16 +133,335 @@
 antity%0A%0A
+ENTITY_SPACES = %7B%0A    %22tap%22: QUANTITY_SPACES,%0A    %22drain%22: QUANTITY_SPACES,%0A    %22sink%22: QUANTITY_SPACES%0A%7D%0A%0AQUANTITY_RELATIONSHIPS = %7B%0A    %22I+%22: (QUANTITY_SPACES, QUANTITY_SPACES),%0A    %22I-%22: (QUANTITY_SPACES, QUANTITY_SPACES),%0A    %22P+%22: (QUANTITY_SPACES, QUANTITY_SPACES),%0A    %22P-%22: (QUANTITY_SPACES, QUANTITY_SPACES)%0A%7D%0A
 %0Aclass S
@@ -743,24 +743,25 @@
 %0A    pass%0A%0A%0A
+#
 class State:
@@ -759,16 +759,40 @@
 ss State
+(Quantity, Relationship)
 :%0A    # 
@@ -805,255 +805,1823 @@
 ns:%0A
+%0A
     #
- Tap%0A        # Quantities%0A            # Inflow%0A    # Drain%0A        # Quantities%0A            # Outflow%0A    # Sink%0A        # Quantities%0A            # Volume%0A    pass%0A%0A%0Aclass Entity:%0A    # has:%0A        # quantities%0A        # dependencies%0A    pass%0A%0A
+def __init__(previous_state):%0A        #self.tap = Quantity(%22inflow%22, %220%22, %220%22)%0A        #self.drain = Quantity(%22outflow%22, %220%22, %220%22)%0A        #self.sink = Quantity(%22volume%22, %220%22, %220%22)%0A        #self.sink = Quantity(%22pressure%22, %220%22, %220%22)%0A        #self.sink = Quantity(%22height%22, %220%22, %220%22)%0A        # Tap%0A        # Drain%0A        # Sink%0A%0Aclass Entity:%0A    entity = None%0A%0A    # quantities%0A    def __init__(self, entity):%0A        assert entity in ENTITY_SPACES.keys(), %22Unknown entity%22%0A        self.entity = ENTITY_SPACES%5Bentity%5D%0A %0A    # dependencies%0A%0A%0Aclass Relationship:%0A    quantity1 = None%0A    quantity2 = None%0A    relation = None%0A%0A    def __init__(self, quantity1, quanity2, relation):%0A        assert quantity1 in QUANTITY_SPACES.keys(), %22Unknown quantity%22%0A        assert quantity2 in QUANTITY_SPACES.keys(), %22Unknown quantity%22%0A        assert relation in QUANTITY_RELATIONSHIPS.keys(), %22Unknown relationship%22%0A        self.quantity1 = quantity1%0A        self.quantity2 = quantity2%0A        self.relation = relation%0A%0Aclass VC(Relationship):%0A    magnitude1 = None%0A    magnitude2 = None%0A%0A    def __init__(self, quantity1, magnitude1, quantity2, magnitude2):%0A        assert quantity1 in QUANTITY_SPACES.keys(), %22Unknown quantity%22%0A        assert quantity2 in QUANTITY_SPACES.keys(), %22Unknown quantity%22%0A        assert magnitude1 in quantity1.quantity_space, %22Invalid value for magnitude: %7B%7D%22.format(magnitude1)%0A        assert magnitude2 in quantity2.quantity_space, %22Invalid value for magnitude: %7B%7D%22.format(magnitude2)%0A        self.quantity1 = quantity1%0A        self.quantity2 = quantity2%0A        self.magnitude1 = magnitude1%0A        self.magnitude2 = magnitude2%0A%0A    def Check_VC():%0A        if(self.quantity2.magnitude == self.magnitude2):%0A            assert self.quantity1.magnitude == self.magnitude1, %22VC Condition failure%22
 %0A

Add rudimentary logic for relations/dependencies