SolarSystem::SolarSystem(vector<SpaceObject> spaceObjects) { this->spaceObjects.swap(spaceObjects); assignObjects(planets, "planet"); assignMoons(); }
/** * Constructor that will add the space objects to the system * and will also assign them to their respective groups */ SolarSystem::SolarSystem(vector<SpaceObject> &spaceObjects) { this->spaceObjects = spaceObjects; assignObjects(); assignMoons(); }
/** * @brief Parser::parse Parses the sentence and creates the trees * @return the trees */ STvector Parser::parse(){ SyntaxTree S(new TNpair(GtSpair(SENTENCE,SyntaxWord()))); //At the beginning, CURRENT is at the true root std::size_t cutoff = 0; while(recDescent(S,cutoff)){ //RecDescends based on the CURRENT pointer in the tree _valid.insert(_valid.end(),S); if(!findFirstIncomplete(S)) //Sets the CURRENT to the first slowest subtree that has more defs to explore break; //If it cannot find any more subtrees with more defs to explore, then stop cutoff = S.leavesBefore(); removePartial(S); } //As long as recdescent is able to continue making trees for(std::size_t i = 0; i < _valid.size(); ++i){ _valid[i].shiftToRoot(); assignType(_valid[i]); attachWords(_valid[i]); assignHeadWords(_valid[i]); assignObjects(_valid[i]); } removeTrees(); return _valid; }