FileDocCategorySizeDatePackage
ArrayListRentABike.javaAPI DocExample1314Sun Apr 24 16:49:26 BST 2005com.springbook

ArrayListRentABike

public class ArrayListRentABike extends Object implements RentABike

Fields Summary
private String
storeName
final List
bikes
Constructors Summary
public ArrayListRentABike(String storeName)

      this.storeName = storeName;
      bikes.add(new Bike("Shimano", "Roadmaster", 20, "11111", 15,
            "Fair"));
      bikes.add(new Bike("Cannondale", "F2000 XTR", 18, "22222",12,
            "Excellent"));
      bikes.add(new Bike("Trek","6000", 19, "33333", 12.4,
            "Fair"));
   
Methods Summary
public voiddeleteBike(Bike bike)

      if(bikes.contains(bike)) bikes.remove(bike);
   
public BikegetBike(java.lang.String serialNo)

      Iterator iter = bikes.iterator();
      while(iter.hasNext()) {
         Bike bike = (Bike)iter.next();
         if(serialNo.equals(bike.getSerialNo())) return bike;

      }

      return null;
   
public java.util.ListgetBikes()

 return bikes; 
public java.lang.StringgetStoreName()

      return storeName;
   
public voidsaveBike(Bike bike)

      if(bikes.contains(bike)) bikes.remove(bike);
      bikes.add(bike);
   
public voidsetStoreName(java.lang.String name)


       
      this.storeName = name;
   
public java.lang.StringtoString()

 return "com.springbook.RentABike: " + storeName;