예제 #1
0
 public boolean addThing(Thing thing) {
   if ((thing.getVolume() + this.getVolume()) <= this.maximumCapacity) {
     this.things.add(thing);
     return true;
   }
   return false;
 }
예제 #2
0
 @Override
 public int getVolume() {
   int volume = 0;
   for (Thing t : this.things) {
     volume = volume + t.getVolume();
   }
   return volume;
 }