PROVIDE "z-addmethod.a4c";
(*
* This file is part of the ASCEND Modeling Library and is released
* under the GNU Public License as described at the end of this file.
*)
(* method add/replace/inherit testing *)
MODEL g0;
NOTES 'pass-test' SELF {
should END up with methods:
METHOD m1;
xprime := 0;
END m1;
} END NOTES;
METHODS
METHOD m1;
x := 0;
END m1;
END g0;
MODEL g1 REFINES g0;
NOTES 'pass-test' SELF {
should END up with
METHOD m1;
xprime := 0;
END m1;
METHOD m2;
y := 1;
END m2;
} END NOTES;
END g1;
MODEL g2 REFINES g1;
NOTES 'pass-test' SELF {
should END up with its original methods.
} END NOTES;
METHODS
METHOD m2;
y := 2;
END m2;
METHOD m1;
x := 2;
END m1;
END g2;
MODEL g3 REFINES g2;
NOTES 'pass-test' SELF {
should END up with it original methods of g2 by inheritance.
} END NOTES;
END g3;
ADD METHODS IN g1;
METHOD m2;
y := 1;
END m2;
END METHODS;
REPLACE METHODS IN g0;
METHOD m1;
xprime := 0;
END m1;
END METHODS;
MODEL b1;
METHODS
METHOD m1;
x:= 1;
END m1;
END b1;
ADD METHODS IN b1;
METHOD m1;
x:= 2;
END m1;
(* rejected we hope*)
END METHODS;
REPLACE METHODS IN b1;
METHOD m2;
y := 1;
END m2;
(* rejected we hope *)
END METHODS;
MODEL backstop;
(* this does nothing important, and should parse ok *)
END backstop;
(*
* z-addmethod.a4c
* by Benjamin A Allan
* Part of the ASCEND Library
* $Date: 1998/06/17 19:39:30 $
* $Revision: 1.3 $
* $Author: mthomas $
* $Source: /afs/cs.cmu.edu/project/ascend/Repository/models/z-addmethod.a4c,v $
*
* This file is part of the ASCEND Modeling Library.
*
* Copyright (C) 1998 Carnegie Mellon University
* Copyright (C) 1997 Benjamin A Allan
*
* The ASCEND Modeling Library is free software; you can redistribute
* it and/or modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* The ASCEND Modeling Library is distributed in hope that it
* will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with the program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139 USA.
*)