@Override public boolean equals(Object obj) { return (obj instanceof KeyRecord) && key.isSimilar(((KeyRecord) obj).key); }
public void quantity(int num){ key.quantity(num); }
@Override public String desc() { return key.toString(); }
public int quantity(){ return key.quantity(); }
@Override public boolean equals(Object obj) { return (obj instanceof KeyRecord) && key.isSimilar(((KeyRecord) obj).key); }
@Override public String desc() { return key.toString(); }
public void quantity(int num){ key.quantity(num); }
public int quantity(){ return key.quantity(); }
public static void add( Key key ){ KeyRecord k = new KeyRecord(key); if (!records.contains(k)){ records.add(k); Collections.sort(records); } else { k = (KeyRecord) records.get(records.indexOf(k)); k.quantity(k.quantity() + key.quantity()); } }
public static void add( Key key ){ KeyRecord k = new KeyRecord(key); if (!records.contains(k)){ records.add(k); Collections.sort(records); } else { k = (KeyRecord) records.get(records.indexOf(k)); k.quantity(k.quantity() + key.quantity()); } }
public static void remove( Key key ){ KeyRecord k = new KeyRecord( key ); if (records.contains(k)){ k = (KeyRecord) records.get(records.indexOf(k)); k.quantity(k.quantity() - key.quantity()); if (k.quantity() <= 0){ records.remove(k); } } }
public static void remove( Key key ){ KeyRecord k = new KeyRecord( key ); if (records.contains(k)){ k = (KeyRecord) records.get(records.indexOf(k)); k.quantity(k.quantity() - key.quantity()); if (k.quantity() <= 0){ records.remove(k); } } }