|
@@ -4,57 +4,18 @@ include "primitives.alh"
|
|
|
SimpleClassDiagrams CoreFormalism {
|
|
|
SimpleAttribute String {
|
|
|
name = "String"
|
|
|
- constraint = $
|
|
|
- String function constraint(model : Element, name : String):
|
|
|
- if (bool_not(is_physical_string(model["model"][name]))):
|
|
|
- return "String has no string value"!
|
|
|
- else:
|
|
|
- return "OK"!
|
|
|
- $
|
|
|
}
|
|
|
|
|
|
SimpleAttribute Permissions {
|
|
|
name = "Permissions"
|
|
|
- constraint = $
|
|
|
- String function constraint(model : Element, name : String):
|
|
|
- Element self
|
|
|
- self = model["model"][name]
|
|
|
- if (bool_not(is_physical_string(self))):
|
|
|
- return "Permissions has no string value"!
|
|
|
- if (bool_not(string_len(self) == 3)):
|
|
|
- return "Permissions string is not of correct length"!
|
|
|
- if (bool_or(cast_integer(string_get(self, 0)) < 0, cast_integer(string_get(self, 0)) > 2)):
|
|
|
- return "Owner permission is not in range [0, 2]"!
|
|
|
- if (bool_or(cast_integer(string_get(self, 1)) < 0, cast_integer(string_get(self, 1)) > 2)):
|
|
|
- return "Group permission is not in range [0, 2]"!
|
|
|
- if (bool_or(cast_integer(string_get(self, 2)) < 0, cast_integer(string_get(self, 2)) > 2)):
|
|
|
- return "Other permission is not in range [0, 2]"!
|
|
|
- return "OK"!
|
|
|
- $
|
|
|
}
|
|
|
|
|
|
SimpleAttribute Boolean {
|
|
|
name = "Boolean"
|
|
|
- constraint = $
|
|
|
- String function constraint(model : Element, name : String):
|
|
|
- if (bool_not(is_physical_boolean(model["model"][name]))):
|
|
|
- return "Boolean has no bool value"!
|
|
|
- else:
|
|
|
- return "OK"!
|
|
|
- $
|
|
|
}
|
|
|
|
|
|
SimpleAttribute Natural {
|
|
|
name = "Natural"
|
|
|
- constraint = $
|
|
|
- String function constraint(model : Element, name : String):
|
|
|
- if (bool_not(is_physical_int(model["model"][name]))):
|
|
|
- return "Natural has no integer value"!
|
|
|
- elif (integer_lt(model["model"][name], 0)):
|
|
|
- return "Natural has negative value"!
|
|
|
- else:
|
|
|
- return "OK"!
|
|
|
- $
|
|
|
}
|
|
|
|
|
|
Class User {
|