public static void main(String[] args) { TestUser user = null; try { user = new TestUser(2899, 5213); Prescription one = user.getPrescription(523436); Prescription two = user.getPrescription(523411); Duplicate dup = null; // one.put(DRUG_ID,198115); // one.put(DRUG_NAME,"Celebrex"); // two.put(DRUG_ID,239819); // two.put(DRUG_NAME,"Eco-5"); dup = Duplicate.compare(user, one, two); if (dup != null) { System.out.println("drugs duplicate, status " + dup.getStatus()); } else { System.out.println("drugs do not duplicate"); } } catch (Exception e) { e.printStackTrace(); } finally { user.finish(); } }
public boolean betterThan(Duplicate other) { if (other == null) return true; if (getStatus() > other.getStatus()) return true; if (getStatus() == other.getStatus()) { if (duplicate.getDate(CREATEDDATE).after(other.duplicate.getDate(CREATEDDATE))) return true; } return false; }
public boolean equals(Duplicate other) { if (other == null) return false; return getDuplicate().equals(other.getDuplicate()); }