source: git/factory/cf_reval.cc @ 464b18

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