MM_consyntax.mvc 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. include "primitives.alh"
  2. SimpleAttribute Integer {
  3. constraint = $
  4. String function constraint(value : Element):
  5. if (is_physical_int(value)):
  6. return "OK"!
  7. else:
  8. return "Integer has a non-integer value"!
  9. $
  10. }
  11. SimpleAttribute String {
  12. constraint = $
  13. String function constraint(value : Element):
  14. if (is_physical_string(value)):
  15. return "OK"!
  16. else:
  17. return "String has a non-string value"!
  18. $
  19. }
  20. SimpleAttribute Float {
  21. constraint = $
  22. String function constraint(value : Element):
  23. if (is_physical_float(value)):
  24. return "OK"!
  25. else:
  26. return "Float has a non-float value"!
  27. $
  28. }
  29. Class Element {
  30. name = "Element"
  31. typeID : String
  32. }
  33. Class Icon : Element {
  34. name = "Icon"
  35. data : String
  36. scale : Float
  37. }
  38. Class PrimitiveGroup : Element {
  39. name = "PrimitiveGroup"
  40. }
  41. Class Primitive {
  42. name = "Primitive"
  43. }
  44. Class Rectangle : Primitive {
  45. name = "Rectangle"
  46. x : Integer
  47. y : Integer
  48. width : Integer
  49. height : Integer
  50. }
  51. Class Circle : Primitive {
  52. name = "Circle"
  53. x : Integer
  54. y : Integer
  55. radius : Integer
  56. }
  57. Association PrimitiveGroupPrimitive(PrimitiveGroup, Primitive) {
  58. name = "PrimitiveGroupPrimitive"
  59. }