net.sf.farrago.test
Class FarragoObjectCacheTest.RentalCar

java.lang.Object
  extended by net.sf.farrago.test.FarragoObjectCacheTest.RentalCar
All Implemented Interfaces:
FarragoAllocation, ClosableAllocation
Enclosing class:
FarragoObjectCacheTest

private class FarragoObjectCacheTest.RentalCar
extends Object
implements FarragoAllocation

RentalCar exemplifies a reusable object.


Field Summary
private  String description
           
private  boolean isDriving
           
private  int mileage
           
 
Constructor Summary
FarragoObjectCacheTest.RentalCar(String description)
          Creates a new car, with an initial mileage of 0 coming out of the factory.
 
Method Summary
 void assureQuality()
          Tests this car's quality after fabrication, throwing a FarragoObjectCacheTest.LemonException if unacceptable.
 void closeAllocation()
          Closes this object.
 void drive(int miles)
          Drives this car, increasing the mileage.
 String getDescription()
           
 int getMileage()
           
 boolean hasEscapePod()
           
 boolean isOld()
           
 boolean isSmokingVehicle()
           
 boolean isTooOld()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

description

private String description

mileage

private int mileage

isDriving

private boolean isDriving
Constructor Detail

FarragoObjectCacheTest.RentalCar

FarragoObjectCacheTest.RentalCar(String description)
Creates a new car, with an initial mileage of 0 coming out of the factory.

Parameters:
description - bland description of this car, e.g. "SUV 12-Door"
Method Detail

getDescription

public String getDescription()
Returns:
description of this car

drive

public void drive(int miles)
Drives this car, increasing the mileage.

Parameters:
miles - number of miles to drive

getMileage

public int getMileage()
Returns:
current mileage for this car

isOld

public boolean isOld()
Returns:
whether this car is old enough that it ought to be discarded

isSmokingVehicle

public boolean isSmokingVehicle()
Returns:
whether this car is a "smoking" vehicle, meaning it can never be reused since that lingering smell is so nasty

hasEscapePod

public boolean hasEscapePod()
Returns:
whether this vehicle comes with an "escape pod" (another rental car inside of it!)

assureQuality

public void assureQuality()
Tests this car's quality after fabrication, throwing a FarragoObjectCacheTest.LemonException if unacceptable.


isTooOld

public boolean isTooOld()
Returns:
whether this car is absolutely too old to be in service as a rental car any more

closeAllocation

public void closeAllocation()
Description copied from interface: ClosableAllocation
Closes this object.

Specified by:
closeAllocation in interface ClosableAllocation