Update Attribute.h

This commit is contained in:
Brandon Jackson 2015-09-15 21:51:50 -05:00
parent 3a18ac0608
commit 51a7197b07

View file

@ -9,41 +9,29 @@ using namespace std;
class Attribute {
//a named column of a relation
string name;
string type;
bool key;
bool isKey;
int size;
public:
vector<string> values;
Attribute(string n, string t, bool k){
name = n;
type = t;
key = k;
size = 0;
}
void initializeAttribute(string n, vector<string> a){
void addRow(string v) {
values.push_back(v);
name = n;
values = a;
}
string getName(){
return name;
}
string getType(){
return type;
}
bool isKey(){
return key;
}
Attribute(){ }
void display()
{
cout<<"Atribute name:\t"<<name<<"\n";
cout<<"Elements: ";
//cout<<"\nAtribute name:\t"<<name<<"\n";
//cout<<"Elements: ";
for (int i = 0; i < values.size(); ++i)
{
cout<<values[i]<<" ";
@ -54,4 +42,33 @@ public:
{
return values.size();
}
void pushBack(string s)
{
values.push_back(s);
}
void erase(int position)
{
values.erase(values.begin()+ position);
}
/*
Attribute(vector<string> v){
this.values = v;
}
Attribute(const Attribute<string>& a){
this.values = a.getAll();
}
Attribute& operator=(const Attribute<string>& a){
this.values = a.getAll();
}
vector<string> getAll(){
return this.values;
}
*/
};