1 /**
2 * \brief Remove overlaps function
3 *
4 * Authors:
5 * Tim Dwyer <tgdwyer@gmail.com>
6 *
7 * Copyright (C) 2005 Authors
8 *
9 * Released under GNU GPL. Read the file 'COPYING' for more information.
10 */
12 #ifndef SEEN_REMOVEOVERLAP_BLOCK_H
13 #define SEEN_REMOVEOVERLAP_BLOCK_H
15 #include <vector>
16 #include <iostream>
17 class Variable;
18 class Constraint;
19 template <class T> class PairingHeap;
20 class StupidPriorityQueue;
22 class Block
23 {
24 friend std::ostream& operator <<(std::ostream &os,const Block &b);
25 public:
26 std::vector<Variable*> *vars;
27 double posn;
28 double weight;
29 double wposn;
30 Block(Variable *v=NULL);
31 ~Block(void);
32 Constraint *findMinLM();
33 Constraint *findMinInConstraint();
34 Constraint *findMinOutConstraint();
35 void deleteMinInConstraint();
36 void deleteMinOutConstraint();
37 double desiredWeightedPosition();
38 void merge(Block *b, Constraint *c, double dist);
39 void mergeIn(Block *b);
40 void mergeOut(Block *b);
41 void split(Block *&l, Block *&r, Constraint *c);
42 void setUpInConstraints();
43 void setUpOutConstraints();
44 double cost();
45 bool deleted;
46 long timeStamp;
47 PairingHeap<Constraint*> *in;
48 PairingHeap<Constraint*> *out;
49 private:
50 void reset_active_lm(Variable *v, Variable *u);
51 double compute_dfdv(Variable *v, Variable *u, Constraint *&min_lm);
52 bool canFollowLeft(Constraint *c, Variable *last);
53 bool canFollowRight(Constraint *c, Variable *last);
54 void populateSplitBlock(Block *b, Variable *v, Variable *u);
55 void addVariable(Variable *v);
56 void setUpConstraintHeap(PairingHeap<Constraint*>* &h,bool in);
57 };
59 #endif // SEEN_REMOVEOVERLAP_BLOCK_H