licheng700

BlogJava 首页 新随笔 联系 聚合 管理
  26 Posts :: 5 Stories :: 5 Comments :: 1 Trackbacks

package iss.com.equals;

import java.util.Date;

class CountIsable {

 private Date date;

 private String accountNo;

 private String bankCode;

 public CountIsable(Date transactionTime, String accountNo, String bankCode) {
  this.date = transactionTime;
  this.accountNo = accountNo;
  this.bankCode = bankCode;
 }

 public CountIsable(String accountNo, String bankCode) {
  this.accountNo = accountNo;
  this.bankCode = bankCode;
 }
               
 public boolean equals(CountIsable mapKey) {
  if (DateUtil.compareDate(date, mapKey.getDate()) == 0
    && accountNo.equals(mapKey.getAccountNo())) {
   if (mapKey.getBankCode() == null
     || mapKey.getBankCode().equals(bankCode))
    return true;
  }
  return false;
 }
 public boolean equals(Object key) {
  CountIsable mapKey=(CountIsable)key;
  if (DateUtil.compareDate(date, mapKey.getDate()) == 0
    && accountNo.equals(mapKey.getAccountNo())) {
   if (mapKey.getBankCode() == null
     || mapKey.getBankCode().equals(bankCode))
    return true;
  }
  return false;
 }

 public String toString() {
  return date.toString() + accountNo + bankCode;
 }

public int hashCode() {
 int temp =(date.toString() + accountNo + bankCode).hashCode(); 
  return temp;
 }

 public String getAccountNo() {
  return accountNo;
 }

 public String getBankCode() {
  return bankCode;
 }

 public Date getDate() {
  return date;
 }
}

posted on 2005-07-29 10:04 小海船 阅读(525) 评论(0)  编辑  收藏

只有注册用户登录后才能发表评论。


网站导航: