@Override public void actionPerformed(ActionEvent e) { System.out.println("Matchs found:"); ContactListNode curNode = TreeDex.myContacts.getHead(); while (curNode != null) { Contact curContact = curNode.getContact(); if (curContact.match( TreeDex.contactPanel.firstNameField.getText(), TreeDex.contactPanel.lastNameField.getText(), TreeDex.contactPanel.phoneField.getText(), TreeDex.contactPanel.emailField.getText())) { // print it out curContact.print(); } curNode = curNode.getNext(); } TreeDex.contactPanel.clearFields(); }
@Override public void actionPerformed(ActionEvent e) { ContactListNode curNode = TreeDex.myContacts.getHead(); ContactListNode nextNode; while (curNode != null) { Contact curContact = curNode.getContact(); if (curContact.match( TreeDex.contactPanel.firstNameField.getText(), TreeDex.contactPanel.lastNameField.getText(), TreeDex.contactPanel.phoneField.getText(), TreeDex.contactPanel.emailField.getText())) { // delete this node: nextNode = curNode.getNext(); TreeDex.myContacts.delete(curNode); curNode = nextNode; } else { curNode = curNode.getNext(); } } TreeDex.contactPanel.clearFields(); }
@Override public boolean match(InformationObject objectInfo) { if (this == objectInfo) return true; if (objectInfo == null) return false; if (getClass() != objectInfo.getClass()) return false; User other = (User) objectInfo; if (Address == null && other.Address != null) { return false; } else if (other.Address != null && !Address.match(other.Address)) return false; if (CcCode == null && other.CcCode != null) { return false; } else if (other.CcCode != null && !CcCode.equals(other.CcCode)) return false; if (Contact == null && other.Contact != null) { return false; } else if (other.Contact != null && !Contact.match(other.Contact)) return false; if (CreationDate == null && other.CreationDate != null) { return false; } else if (other.CreationDate != null && !CreationDate.equals(other.CreationDate)) return false; if (ExpirationDate == null && other.ExpirationDate != null) { return false; } else if (other.ExpirationDate != null && !ExpirationDate.equals(other.ExpirationDate)) return false; if (FirstName == null && other.FirstName != null) { return false; } else if (other.FirstName != null && !FirstName.equals(other.FirstName)) return false; if (LastName == null && other.LastName != null) { return false; } else if (other.LastName != null && !LastName.equals(other.LastName)) return false; if (SecurityCode == null && other.SecurityCode != null) { return false; } else if (other.SecurityCode != null && !SecurityCode.equals(other.SecurityCode)) return false; return true; }