@Override
 public List<PairOfInts> getEntries(Order ordering, int n) {
   if (ordering.equals(Order.ByRightElementDescending)) {
     return getEntriesSorted(comparatorRightDescending, n);
   } else if (ordering.equals(Order.ByLeftElementAscending)) {
     return getEntriesSorted(comparatorLeftAscending, n);
   } else if (ordering.equals(Order.ByRightElementAscending)) {
     return getEntriesSorted(comparatorRightAscending, n);
   } else if (ordering.equals(Order.ByLeftElementDescending)) {
     return getEntriesSorted(comparatorLeftDescending, n);
   }
   // Should never get here.
   return null;
 }
 @Override
 public boolean equals(Object obj) {
   if (this == obj) return true;
   if (obj == null) return false;
   if (getClass() != obj.getClass()) return false;
   OrderProductAttribute other = (OrderProductAttribute) obj;
   if (id == null) {
     if (other.id != null) return false;
   } else if (!id.equals(other.id)) return false;
   if (optionValuePrice == null) {
     if (other.optionValuePrice != null) return false;
   } else if (!optionValuePrice.equals(other.optionValuePrice)) return false;
   if (order == null) {
     if (other.order != null) return false;
   } else if (!order.equals(other.order)) return false;
   if (orderProduct == null) {
     if (other.orderProduct != null) return false;
   } else if (!orderProduct.equals(other.orderProduct)) return false;
   if (pricePrefix == null) {
     if (other.pricePrefix != null) return false;
   } else if (!pricePrefix.equals(other.pricePrefix)) return false;
   if (productOption == null) {
     if (other.productOption != null) return false;
   } else if (!productOption.equals(other.productOption)) return false;
   if (productOptionValue == null) {
     if (other.productOptionValue != null) return false;
   } else if (!productOptionValue.equals(other.productOptionValue)) return false;
   return true;
 }
Ejemplo n.º 3
0
 @Override
 public boolean equals(Object obj) {
   if (this == obj) return true;
   if (obj == null) return false;
   if (getClass() != obj.getClass()) return false;
   OrderProduct other = (OrderProduct) obj;
   if (finalPrice == null) {
     if (other.finalPrice != null) return false;
   } else if (!finalPrice.equals(other.finalPrice)) return false;
   if (id == null) {
     if (other.id != null) return false;
   } else if (!id.equals(other.id)) return false;
   if (order == null) {
     if (other.order != null) return false;
   } else if (!order.equals(other.order)) return false;
   if (product == null) {
     if (other.product != null) return false;
   } else if (!product.equals(other.product)) return false;
   if (productsModel == null) {
     if (other.productsModel != null) return false;
   } else if (!productsModel.equals(other.productsModel)) return false;
   if (productsName == null) {
     if (other.productsName != null) return false;
   } else if (!productsName.equals(other.productsName)) return false;
   if (productsPrice == null) {
     if (other.productsPrice != null) return false;
   } else if (!productsPrice.equals(other.productsPrice)) return false;
   if (productsQuantity != other.productsQuantity) return false;
   if (productsTax == null) {
     if (other.productsTax != null) return false;
   } else if (!productsTax.equals(other.productsTax)) return false;
   return true;
 }
Ejemplo n.º 4
0
  public void sort(List<Integer> list, Order order) {

    this.buildMaxHeap(list);

    for (int i = list.size() - 1; i >= 0; i--) {

      this.swap(list, 0, i);

      this.setHeapSize(this.getHeapSize() - 1);

      this.maxHeapify(list, 0);
    }

    if (order.equals(Order.DESCENDING)) {

      Collections.reverse(list);
    }
  }
Ejemplo n.º 5
0
  public boolean equals(Object o) {
    if (this == o) {
      return true;
    }
    if (o == null || getClass() != o.getClass()) {
      return false;
    }

    LineItemPK that = (LineItemPK) o;

    if (!order.equals(that.order)) {
      return false;
    }
    if (!productCode.equals(that.productCode)) {
      return false;
    }

    return true;
  }
Ejemplo n.º 6
0
 @Test
 public void testEqualsObject() {
   assertThat(order1.equals(order2), is(true));
   assertThat(order2.equals(order1), is(true));
   assertThat(order1.equals(order3), is(false));
 }