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 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106
|
/*1:*/
#line 28 "./int_sequence.hweb"
#ifndef INT_SEQUENCE_H
#define INT_SEQUENCE_H
#include <cstring>
#include <vector>
using namespace std;
/*2:*/
#line 46 "./int_sequence.hweb"
class Symmetry;
class IntSequence{
int*data;
int length;
bool destroy;
public:
/*3:*/
#line 83 "./int_sequence.hweb"
IntSequence(int l)
:data(new int[l]),length(l),destroy(true){}
IntSequence(int l,int n)
:data(new int[l]),length(l),destroy(true)
{for(int i= 0;i<length;i++)data[i]= n;}
IntSequence(const IntSequence&s)
:data(new int[s.length]),length(s.length),destroy(true)
{memcpy(data,s.data,length*sizeof(int));}
IntSequence(IntSequence&s,int i1,int i2)
:data(s.data+i1),length(i2-i1),destroy(false){}
IntSequence(const IntSequence&s,int i1,int i2)
:data(new int[i2-i1]),length(i2-i1),destroy(true)
{memcpy(data,s.data+i1,sizeof(int)*length);}
IntSequence(const Symmetry&sy,const vector<int> &se);
IntSequence(const Symmetry&sy,const IntSequence&se);
IntSequence(int i,const IntSequence&s);
IntSequence(int i,const IntSequence&s,int pos);
IntSequence(int l,const int*d)
:data(new int[l]),length(l),destroy(true)
{memcpy(data,d,sizeof(int)*length);}
/*:3*/
#line 53 "./int_sequence.hweb"
;
/*4:*/
#line 107 "./int_sequence.hweb"
const IntSequence&operator= (const IntSequence&s);
virtual~IntSequence()
{if(destroy)delete[]data;}
bool operator==(const IntSequence&s)const;
bool operator!=(const IntSequence&s)const
{return!operator==(s);}
int&operator[](int i)
{return data[i];}
int operator[](int i)const
{return data[i];}
int size()const
{return length;}
/*:4*/
#line 54 "./int_sequence.hweb"
;
/*5:*/
#line 124 "./int_sequence.hweb"
bool operator<(const IntSequence&s)const;
bool operator<=(const IntSequence&s)const
{return(operator==(s)||operator<(s));}
bool lessEq(const IntSequence&s)const;
bool less(const IntSequence&s)const;
/*:5*/
#line 55 "./int_sequence.hweb"
;
void sort();
void monotone();
void pmonotone(const Symmetry&s);
int sum()const;
int mult(int i1,int i2)const;
int mult()const
{return mult(0,length);}
void add(int i);
void add(int f,const IntSequence&s);
int getPrefixLength()const;
int getNumDistinct()const;
int getMax()const;
bool isPositive()const;
bool isConstant()const;
bool isSorted()const;
void print()const;
};
/*:2*/
#line 38 "./int_sequence.hweb"
;
#endif
/*:1*/
|