Exemplo n.º 1
0
void PlaneSegment::sourceIs( Fwk::Ptr<Location> _source )
{
    if (_source == NULL) {
        if (source_ != NULL)
            source_->segmentDel( this );
        source_ = NULL;
    } else if( _source != NULL && _source->type() != Location::truck() && _source->type() != Location::boat()  ) {
        if (source_ != NULL)
            source_->segmentDel( this );
        source_ = _source;
        source_->segmentIs( this );
    } else {
        throw LocationTypeException("Plane segment " + name() + " can't be connected to a truck or boat terminal.");
    }
    return;
}
Exemplo n.º 2
0
void Segment::checkSourceCompat(Fwk::Ptr<Location> source)
{
    if((source->type() == TRUCK_TERMINAL) || 
        (source->type() == BOAT_TERMINAL) || 
        (source->type() == PLANE_TERMINAL))
    {
            if(this->mode() == TRUCK && source->type() != TRUCK_TERMINAL)
            {
                    throw IncompatibleModeException("Truck Segment and Non-Truck Terminal");
            }
            else if(this->mode() == BOAT && source->type() != BOAT_TERMINAL)
            {
                    throw IncompatibleModeException("Boat Segment and Non-Boat Terminal");
            }
            else if(this->mode() == PLANE && source->type() != PLANE_TERMINAL)
            {
                    throw IncompatibleModeException("Plane Segment and Non-Plane Terminal");
            }
    }
}
Exemplo n.º 3
0
void
Stats::onLocationNew(Fwk::Ptr<Location> location) {
    switch (location->type()) {
        case Location::customer:
            ++numCustomerLocations_;
            break;
        case Location::port:
            ++numPorts_;
            break;
        case Location::truckTerminal:
            ++numTruckTerminals_;
            break;
        case Location::boatTerminal:
            ++numBoatTerminals_;
            break;
        case Location::planeTerminal:
            ++numPlaneTerminals_;
            break;
        default: break;
    }
}