-
Notifications
You must be signed in to change notification settings - Fork 0
/
EdgeDescriptor.h
51 lines (38 loc) · 1.4 KB
/
EdgeDescriptor.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#ifndef EDGE_DESCRIPTOR_H
#define EDGE_DESCRIPTOR_H
//в этом классе реализованы все методы.
template <typename Vertex_t, typename Weight_t, typename Data_t>
class EdgeDescriptor
{
private:
Vertex_t* from;
Vertex_t* to;
Weight_t weight;
Data_t data;
public:
EdgeDescriptor (Vertex_t* _from, Vertex_t* _to) : from(_from), to(_to){}
EdgeDescriptor (Vertex_t* _from, Vertex_t* _to, Weight_t _weight) :
from(_from), to(_to), weight(_weight){}
EdgeDescriptor (Vertex_t* _from, Vertex_t* _to, Weight_t _weight, Data_t _data) :
from(_from), to(_to), weight(_weight), data(_data){}
~EdgeDescriptor (){}
Vertex_t* getBegin (){return from;}
void setBegin (Vertex_t* _pvertex){from = _pvertex;}
Vertex_t* getEnd (){return to;}
void setEnd (Vertex_t* _pvertex){to = _pvertex;}
Weight_t getWeight (){return weight;}
void setWeight (Weight_t _weight){weight = _weight;}
Weight_t& getSWeight (){return weight;}
Data_t getData (){return data;}
void setData (Data_t _data){data = _data;}
Data_t& getSData (){return data;}
bool isComingTo (Vertex_t* _pvertex){return ((to == _pvertex)? true : false);}
bool isComingFrom (Vertex_t* _pvertex){return ((from == _pvertex)? true : false);}
Vertex_t* other (Vertex_t* pvertex)
{
if (pvertex == this->getBegin())
return getEnd();
return NULL;
}
};
#endif // EDGE_DESCRIPTOR_H