Exemplo n.º 1
0
    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

    # To view the rule of a field we can simply inspect its rule property.
    # (This property is fixed by the model file and is immutable at runtime)

    print("\u0332".join("Field Rules:"))
    # As it is a normal class all fields are per definition rule_fields
    for field in my_building.get_fields():
        print(f"Name: {field.name}, Rule: {field.rule}")
    print("")

    # Possible rules are:
    # - min n
    # - max n
    # - exactly n
    # - some (equals min 1)
    # - all

    # A field can have multiple rules that all need to be fulfilled for the
    # field to be treated as valid. An instance is valid if all its fields
    # are valid

    print("\u0332".join("my_building is currently valid:"))