1 /**
2 *
3 * Authors:
4 * Tim Dwyer <tgdwyer@gmail.com>
5 *
6 * Copyright (C) 2005 Authors
7 *
8 * Released under GNU LGPL. Read the file 'COPYING' for more information.
9 */
10 #ifndef SEEN_REMOVEOVERLAP_VARIABLE_H
11 #define SEEN_REMOVEOVERLAP_VARIABLE_H
13 #include <vector>
14 #include <iostream>
15 #include "block.h"
17 namespace vpsc {
19 class Constraint;
20 typedef std::vector<Constraint*> Constraints;
21 class Variable
22 {
23 friend std::ostream& operator <<(std::ostream &os, const Variable &v);
24 public:
25 const int id; // useful in log files
26 double desiredPosition;
27 const double weight;
28 double offset;
29 Block *block;
30 bool visited;
31 Constraints in;
32 Constraints out;
33 char *toString();
34 inline Variable(const int id, const double desiredPos, const double weight)
35 : id(id)
36 , desiredPosition(desiredPos)
37 , weight(weight)
38 , offset(0)
39 , block(NULL)
40 , visited(false)
41 {
42 }
43 inline double position() const {
44 return block->posn+offset;
45 }
46 //double position() const;
47 virtual ~Variable(void){
48 in.clear();
49 out.clear();
50 }
51 };
52 }
53 #endif // SEEN_REMOVEOVERLAP_VARIABLE_H