Ejemplo n.º 1
0
Path::Ptr PathTree::addChildren(unsigned int children, 
    Path::Ptr curPath, Path::Ptr frontPath, PathItem pI) {
        if (children > 1){
            FWK_DEBUG("Conn::ExplorePathTree::processQueueFront()" <<
                    " adding new Path to queue");
            Path::Ptr newPath = curPath->cloneIs();
            newPath->costIs(Dollars(newPath->cost().value() +
                    segmentCost(pI.seg, newPath->expediteSupport())));
            newPath->timeIs(Hours(newPath->time().value() +
                    segmentTime(pI.seg, newPath->expediteSupport())));
            newPath->distanceIs(Miles(newPath->distance().value() +
                    pI.seg->length().value()));
            path_.push_back(newPath);
            queue_.push(path_.back());
        } else {
            FWK_DEBUG("Conn::ExplorePathTree::processQueueFront() " <<
                    "adding same Path to queue");
            frontPath->costIs(Dollars(frontPath->cost().value() +
                    segmentCost(pI.seg, frontPath->expediteSupport())));
            frontPath->timeIs(Hours(frontPath->time().value() +
                    segmentTime(pI.seg, frontPath->expediteSupport())));
            frontPath->distanceIs(Miles(frontPath->distance().value() +
                    pI.seg->length().value()));
            queue_.push(frontPath);
        }
        queue_.back()->nextPathItemIs(pI);
        return queue_.back();
};
Ejemplo n.º 2
0
Path::Ptr Path::cloneIs() {
    FWK_DEBUG("Conn::Path::cloneIs()");
    Path::Ptr clonedPath = new Path();
    clonedPath->traversedItems_ = traversedItems_;
    clonedPath->costIs(cost());
    clonedPath->timeIs(time());
    clonedPath->distanceIs(distance());
    return clonedPath;
};