Exemplo n.º 1
0
    # # 3 Class Fields
    #
    # Our classes possess fields that we use to model the state. There are
    # multiple types of fields a normal-class or device-class can have.
    # Basically a field is a set to which values can be added, but that posses
    # additional functions and internal logic. Therefore values of a field
    # are without duplicates and without order
    # (These requirements are needed to manage the state merge of concurrent
    # changes)

    # To view all fields a class possesses we can either:
    #   - try the autocompletion hint when typing building.
    #   - look inside the modules file
    #   - use the functions: .get
    print("\u0332".join("All fields of the Building class:"))
    print(my_building.get_all_field_names())
    print("")

    # To manipulate data inside a field all standard set interactions are
    # given:
    my_building.goalTemperature.add(23)
    my_building.goalTemperature.update([12])
    my_building.goalTemperature.remove(23)
    my_building.goalTemperature.clear()

    # ## 3.1 RuleFields
    #
    # A RuleField contains 1 or multiple rules that need to be fulfilled
    # for the field to be valid. RuleFields are separated into Relation- and
    # DataFields. All fields of normal classes are RuleFields