File: defmethods.mlw

package info (click to toggle)
why3 1.8.2-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 45,028 kB
  • sloc: xml: 185,443; ml: 111,224; ansic: 3,998; sh: 2,578; makefile: 2,568; java: 865; python: 720; javascript: 290; lisp: 205; pascal: 173
file content (46 lines) | stat: -rw-r--r-- 769 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
module ClassA
	use int.Int
	use mach.java.lang.Integer
  	type t = {
		mutable a : integer;
		mutable b : bool;
  	}
end

module DefaultMethods
    use ClassA
	use mach.java.lang.Integer
	use mach.java.lang.Array

  	type t = {
		mutable a : integer;
		mutable c : ClassA.t;
		mutable b : array (array bool);
		mutable d : string;
		mutable z : bool;
  	}
end

module HashCodeRedef 
  use mach.java.lang.Integer

  type t = {
	mutable a : integer;
	mutable b : bool;
  }

  let hash_code(self : t) : integer = 
   7211 * self.a + (if self.b then 0 else 1)
end

module EqualsRedef
  use mach.java.lang.Integer

  type t = {
	mutable a : integer;
	mutable b : bool;
  }

  let equals(self obj: t) : bool = 
   	self.a = obj.a && (if self.b then obj.b else not obj.b)
end