19 //====== LIFECYCLE ========
21 Instant::Instant(std::vector<int>* instant)
23 nTuple=new std::vector<int>();
29 nTuple=new std::vector<int>();
32 Instant::Instant(int size)
34 nTuple= new std::vector<int>();
47 //====== OPERATIONS =======
49 * Add a new concept to the instant
50 * @param indexConcept: index concept that is going
51 * to be added of the new concept added to the instant
55 void Instant::addConcept(int value)
57 nTuple->push_back(value);
59 //======= INQUIRY ===========
61 * Returns the value nTuple
64 std::vector<int>* Instant::getInstant()
69 * Returns the index of the concept that's
70 * in the instant's concept index
71 * @param indexConcept: index of the concept in the instant
72 * @return indexInConcept
74 int Instant::getIndexInConcept(int indexConcept)
76 return (*nTuple)[indexConcept];
80 * returns the number of concepts that the instant has
81 * @return nTuple.size()
83 int Instant::getSize()
85 return nTuple->size();
89 * Compares if the instant given is equals to the nTuple
90 * @param instant: instant for compare
91 * @return true if is equals to the nTuple, false otherwise
93 bool Instant::isEquals(Instant* instant)
95 int sizeInstant=instant->getSize();
97 int sizeThisInstant=getSize();
98 if(sizeInstant==sizeThisInstant)
101 for(i=0;i<sizeThisInstant;i++)
103 int indexi=(*nTuple)[i];
104 int indexInConcept=instant->getIndexInConcept(i);
105 if(indexi!=indexInConcept)
115 //=========== ACCESS ==========
118 * @param instant: the vector that's going to be save in
121 void Instant::setInstant(std::vector<int>* instant)
124 size=instant->size();
128 nTuple->push_back(k);
133 * Change the concept's index saved in the nTuple index (the index
134 * that's is for that concept
135 * @param indexConcept: Concept that's going to change the value
139 void Instant::setConcept(int indexConcept, int index)
141 (*nTuple)[indexConcept]=index;
144 * remove a concept from the instant
145 * @param indexConcept: Concept that's going to be removec
146 * @return true if succesful, false otherwise
149 bool Instant::removeConcept(int indexConcept)
152 std::vector<int>::iterator conceptsIterator=nTuple->begin();
153 int size=nTuple->size();
158 nTuple->erase(conceptsIterator);