jengelh-datetimespielwiese
Last change
on this file since c4682e0 was
c4682e0,
checked in by Niels Ranosch <ranosch@…>, 11 years ago
|
FIX: In some (inheriting) copy-constructors their base class should be explicitly initialized
|
-
Property mode set to
100644
|
File size:
1.1 KB
|
Line | |
---|
1 | /* emacs edit mode for this file is -*- C++ -*- */ |
---|
2 | /* $Id$ */ |
---|
3 | |
---|
4 | #define MORE_ZEROES |
---|
5 | |
---|
6 | #include "config.h" |
---|
7 | |
---|
8 | #include "cf_assert.h" |
---|
9 | |
---|
10 | #include "cf_defs.h" |
---|
11 | #include "cf_reval.h" |
---|
12 | |
---|
13 | |
---|
14 | REvaluation::REvaluation( const REvaluation & e ):Evaluation() |
---|
15 | { |
---|
16 | if ( e.gen == 0 ) |
---|
17 | gen = 0; |
---|
18 | else |
---|
19 | gen = e.gen->clone(); |
---|
20 | values = e.values; |
---|
21 | } |
---|
22 | |
---|
23 | REvaluation::~REvaluation() |
---|
24 | { |
---|
25 | if ( gen != 0 ) |
---|
26 | delete gen; |
---|
27 | } |
---|
28 | |
---|
29 | REvaluation& |
---|
30 | REvaluation::operator= ( const REvaluation & e ) |
---|
31 | { |
---|
32 | if ( this != &e ) { |
---|
33 | if (gen!=0) |
---|
34 | delete gen; |
---|
35 | values = e.values; |
---|
36 | if ( e.gen == 0 ) |
---|
37 | gen = 0; |
---|
38 | else |
---|
39 | gen = e.gen->clone(); |
---|
40 | } |
---|
41 | return *this; |
---|
42 | } |
---|
43 | |
---|
44 | void |
---|
45 | REvaluation::nextpoint() |
---|
46 | { |
---|
47 | int n = values.max(); |
---|
48 | for ( int i = values.min(); i <= n; i++ ) |
---|
49 | values[i] = gen->generate(); |
---|
50 | } |
---|
51 | |
---|
52 | void |
---|
53 | REvaluation::nextpoint (int n) |
---|
54 | { |
---|
55 | int m= values.max(); |
---|
56 | int t= values.min(); |
---|
57 | for (int i= t; i <= m; i++) |
---|
58 | values [i]= 0; |
---|
59 | |
---|
60 | if (m == t) |
---|
61 | { |
---|
62 | values [t]= gen->generate(); |
---|
63 | return; |
---|
64 | } |
---|
65 | for (int i= 0; i < n; i++) |
---|
66 | { |
---|
67 | int l= factoryrandom (m - t + 1) + t; |
---|
68 | values [l]= gen->generate(); |
---|
69 | } |
---|
70 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.