/[ascend]/trunk/models/z-addmethod.a4c
ViewVC logotype

Contents of /trunk/models/z-addmethod.a4c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1 - (show annotations) (download) (as text)
Fri Oct 29 20:54:12 2004 UTC (19 years, 7 months ago) by aw0a
File MIME type: text/x-ascend
File size: 2510 byte(s)
Setting up web subdirectory in repository
1 PROVIDE "z-addmethod.a4c";
2 (*
3 * This file is part of the ASCEND Modeling Library and is released
4 * under the GNU Public License as described at the end of this file.
5 *)
6 (* method add/replace/inherit testing *)
7
8 MODEL g0;
9 NOTES 'pass-test' SELF {
10 should END up with methods:
11 METHOD m1;
12 xprime := 0;
13 END m1;
14 } END NOTES;
15 METHODS
16 METHOD m1;
17 x := 0;
18 END m1;
19 END g0;
20
21 MODEL g1 REFINES g0;
22 NOTES 'pass-test' SELF {
23 should END up with
24 METHOD m1;
25 xprime := 0;
26 END m1;
27 METHOD m2;
28 y := 1;
29 END m2;
30 } END NOTES;
31 END g1;
32
33 MODEL g2 REFINES g1;
34 NOTES 'pass-test' SELF {
35 should END up with its original methods.
36 } END NOTES;
37 METHODS
38 METHOD m2;
39 y := 2;
40 END m2;
41 METHOD m1;
42 x := 2;
43 END m1;
44 END g2;
45
46 MODEL g3 REFINES g2;
47 NOTES 'pass-test' SELF {
48 should END up with it original methods of g2 by inheritance.
49 } END NOTES;
50 END g3;
51
52 ADD METHODS IN g1;
53 METHOD m2;
54 y := 1;
55 END m2;
56 END METHODS;
57
58 REPLACE METHODS IN g0;
59 METHOD m1;
60 xprime := 0;
61 END m1;
62 END METHODS;
63
64 MODEL b1;
65 METHODS
66 METHOD m1;
67 x:= 1;
68 END m1;
69 END b1;
70
71 ADD METHODS IN b1;
72 METHOD m1;
73 x:= 2;
74 END m1;
75 (* rejected we hope*)
76 END METHODS;
77
78 REPLACE METHODS IN b1;
79 METHOD m2;
80 y := 1;
81 END m2;
82 (* rejected we hope *)
83 END METHODS;
84
85 MODEL backstop;
86 (* this does nothing important, and should parse ok *)
87 END backstop;
88
89
90 (*
91 * z-addmethod.a4c
92 * by Benjamin A Allan
93 * Part of the ASCEND Library
94 * $Date: 1998/06/17 19:39:30 $
95 * $Revision: 1.3 $
96 * $Author: mthomas $
97 * $Source: /afs/cs.cmu.edu/project/ascend/Repository/models/z-addmethod.a4c,v $
98 *
99 * This file is part of the ASCEND Modeling Library.
100 *
101 * Copyright (C) 1998 Carnegie Mellon University
102 * Copyright (C) 1997 Benjamin A Allan
103 *
104 * The ASCEND Modeling Library is free software; you can redistribute
105 * it and/or modify it under the terms of the GNU General Public
106 * License as published by the Free Software Foundation; either
107 * version 2 of the License, or (at your option) any later version.
108 *
109 * The ASCEND Modeling Library is distributed in hope that it
110 * will be useful, but WITHOUT ANY WARRANTY; without even the implied
111 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
112 * See the GNU General Public License for more details.
113 *
114 * You should have received a copy of the GNU General Public License
115 * along with the program; if not, write to the Free Software
116 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139 USA.
117 *)

john.pye@anu.edu.au
ViewVC Help
Powered by ViewVC 1.1.22