00001
00002 #ifndef NODE_H
00003 #define NODE_H
00004
00005
00006
00007 template <class T1, class T2, int key>
00008 class Node2 {
00009
00010 friend bool operator<(const Node2<T1,T2,key>& left, const Node2<T1,T2,key>& right)
00011 {
00012 return (key == 0) ? (left.a < right.a) : (left.b < right.b);
00013 };
00014
00015
00016 friend bool operator>(const Node2<T1,T2,key>& left, const Node2<T1,T2,key>& right)
00017 {
00018 return (key == 0) ? (left.a > right.a) : (left.b > right.b);
00019 };
00020
00021 friend bool operator==(const Node2<T1,T2,key>& left, const Node2<T1,T2,key>& right)
00022 {
00023 return (key == 0) ? (left.a == right.a) : (left.b == right.b);
00024 };
00025
00026 public:
00027
00028 T1 a;
00029 T2 b;
00030
00031 Node2(T1 x, T2 dist) {
00032 this->a = a;
00033 this->b = b;
00034 };
00035 };
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058 template <class T1, class T2, class T3, int key>
00059 class Node3 {
00060
00061 friend bool operator<(const Node3<T1,T2,T3,key>& left, const Node3<T1,T2,T3,key>& right)
00062 {
00063 if (key == 0)
00064 return left.a < right.a;
00065
00066 else if (key == 1)
00067 return left.b < right.b;
00068
00069 else if (key == 2)
00070 return left.c < right.c;
00071
00072 else
00073 return false;
00074 };
00075
00076 friend bool operator>(const Node3<T1,T2,T3,key>& left, const Node3<T1,T2,T3,key>& right)
00077 {
00078 if (key == 0)
00079 return left.a > right.a;
00080
00081 else if (key == 1)
00082 return left.b > right.b;
00083
00084 else if (key == 2)
00085 return left.c > right.c;
00086
00087 else
00088 return false;
00089 };
00090
00091 friend bool operator==(const Node3<T1,T2,T3,key>& left, const Node3<T1,T2,T3,key>& right)
00092 {
00093 if (key == 0)
00094 return ( (left.b == right.b && left.c == right.c) || (left.c == right.b && left.b == right.c) );
00095
00096 else if (key == 1)
00097 return ( (left.a == right.a && left.c == right.c) || (left.c == right.a && left.a == right.c) );
00098
00099 else if (key == 2)
00100 return ( (left.b == right.b && left.a == right.a) || (left.a == right.b && left.b == right.a) );
00101
00102 else
00103 return false;
00104 };
00105
00106 public:
00107
00108 T1 a;
00109 T2 b;
00110 T3 c;
00111
00112 Node3(T1 a, T2 b, T3 c) {
00113 this->a = a;
00114 this->b = b;
00115 this->c = c;
00116 };
00117 };
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174 #endif
00175
00176
00177