1 # coding: utf-8
2 # frozen_string_literal: true
3
4
5
6 module Umu
7
8 module Value
9
10 module Core
11
12 module Atom
13
14 class Abstract < Object
15 attr_reader :val
16
17
18 def initialize(val)
19 ASSERT.kind_of val, ::Object # Polymophic
20
21 super()
22
23 @val = val
24 end
25
26
27 define_instance_method(
28 :meth_is_equal,
29 :'==', [],
30 [VC::Top], VCA::Bool
31 )
32 def meth_is_equal(_loc, _env, _event, other)
33 ASSERT.kind_of other, VC::Top
34
35 VC.make_bool(
36 other.kind_of?(self.class) && self.val == other.val
37 )
38 end
39
40
41 define_instance_method(
42 :meth_is_not_equal,
43 :'<>', [],
44 [VC::Top], VCA::Bool
45 )
46
47
48 define_instance_method(
49 :meth_is_less_than,
50 :'<', [],
51 [self], VCA::Bool
52 )
53 def meth_is_less_than(_loc, _env, _event, other)
54 ASSERT.kind_of other, Atom::Abstract
55
56 VC.make_bool self.val < other.val
57 end
58 end
59 Abstract.freeze
60
61 end # Umu::Value::Core::Atom
62
63 end # Umu::Value::Core
64
65 end # Umu::Value
66
67 end # Umu