inheritanceAPI
index
/home/hv/src/courses/SoftwareDesign/lecture.OO/inheritanceAPI.py

 
Modules
            
types

 
Classes
            
Aircraft
Glider
PassengerAircraft(Aircraft, PassengerVehicle)
Angle
exceptions.Exception
RangeError
PassengerVehicle

 
class Aircraft
      Encapsulates Aircraft properties.
 
  
__init__(self, heading=None)
__init__([heading:Angle|[0,360[ = Angle(0)]) Aircraft constructor.
__str__(self)
 __str__() -> String representation of an Aircraft instance.
 
Example: str(Aircraft(Angle(20))) returns "<Aircraft:3:<Angle:20>>"
getHeading(self)
 getHeading() -> Angle
getUID(self)
 getUID() -> Unique aircraft ID (Integer)
turn(self, angle=None)
 turn([angle:Angle|[0,360[ = Angle(0)]) adds angle to heading.

 
class Angle
      Encapsulates an Integer 0 <= angle < 360
 
  
__add__(self, angle)
 __add__(angle:Angle or Integer) --> Angle object, sum of self and angle
Raises: 
  TypeError if angle argument is not an Integer nor an Angle
  RangeError if an Integer angle argument is not in [0, 360[ range
__init__(self, value=0)
 Angle([0 <= value:Integer = 0 < 360]) constructor.
__str__(self)
 __str__() -> String representation of an Angle.
 
Example: str(Angle(20)) returns "<Angle:20>"
getValue(self)
 getValue() -> Integer in [0,360[
 
Get the Angle value.
setValue(self, value=0)
 setValue([0 <= value:Integer = 0 < 360]) ->
 
Set the Angle value. 
The value is kept in a private variable __data
Raises:
  TypeError if value is not an Integer
  RangeError if value not in [0, 360[ range

 
class Glider(Aircraft)
      Encapsulates Glider (a special kind of Aircraft) properties.
 
  
__init__(self, heading=None)
__init__([heading:Angle|[0,360[ = Angle(0)]) Glider constructor.
__str__(self)
 __str__() -> String representation of a Glider instance.
 
Example: str(Glider(Angle(20))) returns 
         "<Glider:<Aircraft:3:<Angle:20>>:Not Attached>"
attachTowline(self)
 attachTowline() attaches towline.
detachTowline(self)
 detachTowline() detaches towline.
getHeading(self) from Aircraft
getUID(self) from Aircraft
towlineAttached(self)
 towlineAttached() -> 0|1  (whether towline is attached).
turn(self, angle=None) from Aircraft

 
class PassengerAircraft(Aircraft, PassengerVehicle)
       Encapsulates properties of both Aircraft and PassengerVehicle.
(multiple inheritance)
 
  
_PassengerVehicle__checkPassengerType = __checkPassengerType(self, passengers) from PassengerVehicle
__init__(self)
 __init__() PassengerAircraft constructor.
__str__(self)
 __str__() -> String representation of a PassengerAircraft instance.
 
Example: str(PassengerAircraft()) for the third instantiated Aircraft 
  returns "<PassengerAircraft:<Aircraft:3:<Angle:20>>:<PassengerVehicle:0>>"
board(self, passengers=0) from PassengerVehicle
getHeading(self) from Aircraft
getUID(self) from Aircraft
isEmpty(self) from PassengerVehicle
numPassengers(self) from PassengerVehicle
turn(self, angle=None) from Aircraft
unload(self, passengers=0) from PassengerVehicle

 
class PassengerVehicle
      Encapsulates an infinite capacity
Passenger Vehicle's properties (number of passengers).
 
  
_PassengerVehicle__checkPassengerType = __checkPassengerType(self, passengers)
 __checkPassengerType(passengers)
Raises TypeError if non-Integer or negative argument
__init__(self, passengers=0)
__init__([passengers:PosInteger = 0]) PassengerVehicle constructor.
__str__(self)
 __str__() -> String representation of a PassengerVehicle instance.
 
Example: str(PassengerVehicle(10)) returns 
         "<PassengerVehicle:10>"
board(self, passengers=0)
 board([passengers:PosInteger = 0]) board passengers
isEmpty(self)
 isEmpty() -> 1|0 empty status of the vehicle
numPassengers(self)
 numPassengers() -> number of passengers (Integer)
unload(self, passengers=0)
 board([passengers:PosInteger = 0]) unload passengers

 
class RangeError(exceptions.Exception)
      raised when a value is out of legal range
 
  
__getitem__(...) from exceptions.Exception
__init__(...) from exceptions.Exception
__str__(...) from exceptions.Exception

 
Data
             __file__ = './inheritanceAPI.py'
__name__ = 'inheritanceAPI'