Open
Graph Drawing
Framework

 v. snapshot-2017-02-16
 

MDMFLengthAttribute.h
Go to the documentation of this file.
1 
32 #pragma once
33 
34 #include <ogdf/basic/basic.h>
35 
36 namespace ogdf {
37 namespace embedder {
38 
46 {
47 public:
49  MDMFLengthAttribute() { a = b = 0; }
50 
52  MDMFLengthAttribute(int _a, int _b = 0) : a(_a), b(_b) { }
53 
55  MDMFLengthAttribute(const MDMFLengthAttribute& x) : a(x.a), b(x.b) { }
56 
59 
61  a = x.a;
62  b = x.b;
63  return *this;
64  }
65 
67  a += x.a;
68  b += x.b;
69  return *this;
70  }
71 
73  a -= x.a;
74  b -= x.b;
75  return *this;
76  }
77 
78  //the two components:
79  int a;
80  int b;
81 };
82 
83 inline bool operator==(const MDMFLengthAttribute& x, const MDMFLengthAttribute& y) {
84  return x.a == y.a && x.b == y.b;
85 }
86 
87 inline bool operator!=(const MDMFLengthAttribute& x, const MDMFLengthAttribute& y) {
88  return !(x == y);
89 }
90 
91 inline bool operator<(const MDMFLengthAttribute& x, const MDMFLengthAttribute& y) {
92  return x.a < y.a || (x.a == y.a && x.b < y.b);
93 }
94 
95 inline bool operator>(const MDMFLengthAttribute& x, const MDMFLengthAttribute& y) {
96  return y < x;
97 }
98 
99 inline bool operator>=(const MDMFLengthAttribute& x, const MDMFLengthAttribute& y) {
100  return !(x < y);
101 }
102 
103 inline bool operator<=(const MDMFLengthAttribute& x, const MDMFLengthAttribute& y) {
104  return !(y < x);
105 }
106 
108  x += y;
109  return x;
110 }
111 
113  x -= y;
114  return x;
115 }
116 
117 inline ostream& operator<<(ostream& s, const MDMFLengthAttribute& x) {
118  s << x.a << ", " << x.b;
119  return s;
120 }
121 
122 }
123 }
ostream & operator<<(ostream &s, const MDMFLengthAttribute &x)
MDMFLengthAttribute & operator-=(const MDMFLengthAttribute &x)
Auxiliary length attribute.
MDMFLengthAttribute operator-(MDMFLengthAttribute x, const MDMFLengthAttribute &y)
MDMFLengthAttribute & operator+=(const MDMFLengthAttribute &x)
bool operator==(const MDMFLengthAttribute &x, const MDMFLengthAttribute &y)
MDMFLengthAttribute(int _a, int _b=0)
Converting constructor from int, default second is 0.
MDMFLengthAttribute()
Default constructor for (0, 0)
bool operator!=(const MDMFLengthAttribute &x, const MDMFLengthAttribute &y)
bool operator>=(const MDMFLengthAttribute &x, const MDMFLengthAttribute &y)
MDMFLengthAttribute & operator=(const MDMFLengthAttribute &x)
bool operator<(const MDMFLengthAttribute &x, const MDMFLengthAttribute &y)
Basic declarations, included by all source files.
bool operator>(const MDMFLengthAttribute &x, const MDMFLengthAttribute &y)
MDMFLengthAttribute(const MDMFLengthAttribute &x)
Copy constructor.
The namespace for all OGDF objects.
bool operator<=(const MDMFLengthAttribute &x, const MDMFLengthAttribute &y)
MDMFLengthAttribute operator+(MDMFLengthAttribute x, const MDMFLengthAttribute &y)