001: /*
002: * Copyright 2006 JBoss Inc
003: *
004: * Licensed under the Apache License, Version 2.0 (the "License");
005: * you may not use this file except in compliance with the License.
006: * You may obtain a copy of the License at
007: *
008: * http://www.apache.org/licenses/LICENSE-2.0
009: *
010: * Unless required by applicable law or agreed to in writing, software
011: * distributed under the License is distributed on an "AS IS" BASIS,
012: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013: * See the License for the specific language governing permissions and
014: * limitations under the License.
015: */
016:
017: package org.drools;
018:
019: /**
020: * @author etirelli
021: *
022: */
023: public class OrderItem {
024: private int seq;
025: private Order order;
026:
027: public OrderItem() {
028: this (null, 0);
029: }
030:
031: public OrderItem(final Order order, final int seq) {
032: this .order = order;
033: this .seq = seq;
034: }
035:
036: /**
037: * @return the order
038: */
039: public Order getOrder() {
040: return this .order;
041: }
042:
043: /**
044: * @param order the order to set
045: */
046: public void setOrder(final Order order) {
047: this .order = order;
048: }
049:
050: /**
051: * @return the seq
052: */
053: public int getSeq() {
054: return this .seq;
055: }
056:
057: /**
058: * @param seq the seq to set
059: */
060: public void setSeq(final int seq) {
061: this .seq = seq;
062: }
063:
064: /* (non-Javadoc)
065: * @see java.lang.Object#hashCode()
066: */
067: public int hashCode() {
068: final int PRIME = 31;
069: int result = 1;
070: result = PRIME * result
071: + ((this .order == null) ? 0 : this .order.hashCode());
072: result = PRIME * result + this .seq;
073: return result;
074: }
075:
076: /* (non-Javadoc)
077: * @see java.lang.Object#equals(java.lang.Object)
078: */
079: public boolean equals(final Object obj) {
080: if (this == obj) {
081: return true;
082: }
083: if (obj == null) {
084: return false;
085: }
086: if (getClass() != obj.getClass()) {
087: return false;
088: }
089: final OrderItem other = (OrderItem) obj;
090: if (this .order == null) {
091: if (other.order != null) {
092: return false;
093: }
094: } else if (!this .order.equals(other.order)) {
095: return false;
096: }
097: if (this .seq != other.seq) {
098: return false;
099: }
100: return true;
101: }
102:
103: }
|