2011-12-09 21:50:25 +01:00
|
|
|
|
|
|
|
class grading
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
int h, q;
|
|
|
|
|
|
|
|
public:
|
|
|
|
grading () : h(0), q(0) { }
|
|
|
|
grading (int h_, int q_) : h(h_), q(q_) { }
|
|
|
|
grading (const grading &gr) : h(gr.h), q(gr.q) { }
|
2012-05-03 21:27:05 +02:00
|
|
|
grading (reader &r)
|
|
|
|
{
|
|
|
|
h = r.read_int ();
|
|
|
|
q = r.read_int ();
|
|
|
|
}
|
|
|
|
|
2011-12-09 21:50:25 +01:00
|
|
|
~grading () { }
|
|
|
|
|
|
|
|
grading &operator = (const grading &gr) { h = gr.h; q = gr.q; return *this; }
|
|
|
|
|
|
|
|
grading operator + (const grading &gr) const
|
|
|
|
{
|
|
|
|
return grading (h + gr.h, q + gr.q);
|
|
|
|
}
|
|
|
|
grading operator - (const grading &gr) const
|
|
|
|
{
|
|
|
|
return grading (h - gr.h, q - gr.q);
|
|
|
|
}
|
|
|
|
|
|
|
|
grading &operator += (const grading &gr)
|
|
|
|
{
|
|
|
|
h += gr.h;
|
|
|
|
q += gr.q;
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
|
|
|
grading &operator -= (const grading &gr)
|
|
|
|
{
|
|
|
|
h -= gr.h;
|
|
|
|
q -= gr.q;
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool operator == (const grading &gr) const { return h == gr.h && q == gr.q; }
|
2012-07-27 21:37:47 +02:00
|
|
|
bool operator != (const grading &gr) const { return !operator == (gr); }
|
|
|
|
|
2011-12-09 21:50:25 +01:00
|
|
|
bool operator < (const grading &gr) const
|
|
|
|
{
|
|
|
|
return h < gr.h
|
|
|
|
|| (h == gr.h && q < gr.q);
|
|
|
|
}
|
|
|
|
|
|
|
|
grading mirror_grading (unsigned nplus, unsigned nminus, bool torsion) const;
|
2012-05-03 21:27:05 +02:00
|
|
|
|
|
|
|
void write_self (writer &w) const
|
|
|
|
{
|
|
|
|
w.write_int (h);
|
|
|
|
w.write_int (q);
|
|
|
|
}
|
|
|
|
|
2011-12-09 21:50:25 +01:00
|
|
|
void show_self () const;
|
|
|
|
void display_self () const;
|
|
|
|
};
|