/[ascend]/trunk/models/johnpye/when_test.a4c
ViewVC logotype

Diff of /trunk/models/johnpye/when_test.a4c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 155 by johnpye, Fri Dec 23 00:59:32 2005 UTC revision 156 by johnpye, Fri Dec 23 01:08:33 2005 UTC
# Line 2  REQUIRE "atoms.a4l"; Line 2  REQUIRE "atoms.a4l";
2    
3  MODEL when_test;  MODEL when_test;
4    
5      x IS_A solver_var;      x IS_A variable;
6      y IS_A solver_var;      y IS_A variable;
7            
8      lin: y = x - 1;      lin: y = x - 1;
9      quad: y = x^2 / 4;      quad: y = x^2 / 4;
10    
11      linear IS_A boolean_var;      use_linear IS_A boolean_var;
     linear == (x > 2);  
12    
13      WHEN(linear)      WHEN(use_linear)
14          CASE TRUE:          CASE TRUE:
15              USE lin;              USE lin;
16          CASE FALSE:          CASE FALSE:
# Line 25  METHOD default_self; Line 24  METHOD default_self;
24  END default_self;  END default_self;
25    
26  METHOD specify;  METHOD specify;
27        use_linear.fixed := TRUE;
28      x.fixed := TRUE;      x.fixed := TRUE;
29  END specify;  END specify;
30    
31  METHOD values;  METHOD values;
32        use_linear := FALSE;
33      x := -4;      x := -4;
34  END values;  END values;
35    

Legend:
Removed from v.155  
changed lines
  Added in v.156

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