10 //#include "Instant.h"
23 //====== LIFECYCLE ========
25 SomeThing<U>::SomeThing(std::string name)
31 SomeThing<U>::~SomeThing()
34 instantsVector.clear();
40 //====== OPERATIONS =======
43 * Add a new instant to the thing
44 * @param instant: new instant
47 bool SomeThing<U>::addInstant(Instant* instant)
50 int sizeInstant=instant->getSize();
51 for(int i=0;i<sizeInstant;i++)
52 /// \TODO fix warning unused variable j
53 int j=instant->getIndexInConcept(i);
55 int index= hasInstant(instant);
57 this->instantsVector.push_back(instant);
61 //====== INQUIRY =========
63 * Get the thing stored
67 U* SomeThing<U>::getThing()
72 * Get the name of the thing
76 std::string SomeThing<U>::getName()
81 * Get all the instants
85 std::vector<Instant*>* SomeThing<U>::getInstants()
87 return &instantsVector;
90 * Get the instant that's in the index given
91 * @param indexInstant: index of the instant that they want
92 * @return instants[instantIndex]
95 Instant* SomeThing<U>::getInstant(int indexInstant)
97 return instantsVector[indexInstant];
100 * Get the number of instants that the
102 * @return instants.size()
105 int SomeThing<U>::getNumberInstants()
107 return this->instantsVector.size();
111 * if this is in the instant given
112 * @param instant: instant to verified if this has it
113 * @return 0<=i<numberOfInstants if this has the instant, -1 otherwise
116 int SomeThing<U>::hasInstant(Instant* instant)
119 int sizeInstants=this->getNumberInstants();
121 for(i=0;i<sizeInstants;i++)
123 Instant* instanti=this->getInstant(i);
124 isEquals=instanti->isEquals(instant);
130 //====== ACCESS ==========
136 void SomeThing<U>::setThing(U thing)
141 * Set the name of the thing
145 void SomeThing<U>::setName(std::string name)
147 this->nameThing=name;
150 * Set the instants of the thing
154 void SomeThing<U>::setInstants(std::vector<Instant*> instants)
156 this->instantsVector=instants;
159 * Remove an instant from the thing
160 * @param indexInstant: index of the instant to be removed
161 * @return true if succesful , false otherwise
164 bool SomeThing<U>::removeInstant(int indexInstant)
167 std::vector<Instant*>::iterator instantsIterator=this->instantsVector.begin();
168 int sizeInstants=this->getNumberInstants();
169 for(i=0;i<sizeInstants;i++)
173 this->instantsVector.erase(instantsIterator);
181 * Remove an instant from the thing
182 * @param instant: instant to be deleted
183 * @return true if succesful , false otherwise
186 bool SomeThing<U>::removeInstant(Instant* instant)
188 int index=hasInstant(instant);
191 removeInstant(index);