Example #1
0
 /**
  * Returns all bundle orders in this order for a given bundle
  *
  * @param bundle Bundle to search for
  * @return ArrayList containing all bundle orders for the given bundle
  */
 public ArrayList<AbstractBundleOrder> getBundleOrders(Bundle bundle) {
   ArrayList<AbstractBundleOrder> result = new ArrayList<AbstractBundleOrder>();
   for (Iterator<AbstractBundleOrder> bundleIterator = bundleOrders.values().iterator();
       bundleIterator.hasNext(); ) {
     AbstractBundleOrder bundleOrder = (AbstractBundleOrder) bundleIterator.next();
     if (bundleOrder.getBundle().equals(bundle)) {
       result.add(bundleOrder);
     }
   }
   return result;
 }
Example #2
0
 /**
  * Computes the maximal latest time range of all bundle orders in this order
  *
  * @return Maximal latest time slot
  */
 public int getMaxLate() throws OrderException {
   int result = -1;
   for (Iterator<AbstractBundleOrder> bundleIterator = bundleOrders.values().iterator();
       bundleIterator.hasNext(); ) {
     AbstractBundleOrder bundleOrder = (AbstractBundleOrder) bundleIterator.next();
     if (bundleOrder.getLatest() > result) result = bundleOrder.getLatest();
   }
   if (result == -1) {
     throw new OrderException(
         "No max late computed. No bundle found in this order with a size of "
             + this.getBundleOrders().size());
   }
   return result;
 }
Example #3
0
 /**
  * Computes the minimal early time range of all bundle orders in this order
  *
  * @return Minimal early time slot
  */
 public int getMinEarly() throws OrderException {
   int result = 10000;
   for (Iterator<AbstractBundleOrder> bundleIterator = bundleOrders.values().iterator();
       bundleIterator.hasNext(); ) {
     AbstractBundleOrder bundleOrder = (AbstractBundleOrder) bundleIterator.next();
     if (bundleOrder.getEarly() < result) {
       result = bundleOrder.getEarly();
     }
   }
   if (result == 10000) {
     throw new OrderException("No min early computed. No bundle found in this order");
   }
   return result;
 }
Example #4
0
 /**
  * Removes a bundle order from this order
  *
  * @param bundleOrder Bundle order to remove
  */
 public void removeBundleOrder(AbstractBundleOrder bundleOrder) {
   bundleOrders.remove(bundleOrder.getId());
 }
Example #5
0
 /**
  * Adds a bundle order to this order
  *
  * @param bundleOrder The bundle order to add
  */
 public void addBundleOrder(AbstractBundleOrder bundleOrder) {
   bundleOrders.put(bundleOrder.getId(), bundleOrder);
 }