@Test public void testIdentifyAuthorWithOnlyFirstInitialB() { Author author1 = new Author("Kofia, V (UNIV TORONTO)", Category.INCITES); Author author2 = new Author("Kofia, Victor (UNIV TORONTO)", Category.INCITES); Author author3 = null; HashMap<Author, Author> authorMap = new HashMap<Author, Author>(); authorMap.put(author2, author2); boolean authorIdentified = false; author3 = authorMap.get(author1); if (author3 != null) { authorIdentified = author3.equals(author1) && author3.equals(author2); } assertTrue(authorIdentified); }
@Override public boolean equals(Object other) { Author otherAuthor = (Author) other; boolean isEqual = false, isEqualFirstName = false, isEqualLastName = false; if (this.getOrigin() == Category.INCITES && otherAuthor.getOrigin() == Category.INCITES) { boolean isEqualInstitution = false; isEqualLastName = this.getLastName().equalsIgnoreCase(otherAuthor.getLastName()); isEqualFirstName = this.isSameFirstName(otherAuthor.getFirstName()); String myInstitution = this.getInstitution(), otherInstitution = otherAuthor.getInstitution(); isEqualInstitution = myInstitution.equalsIgnoreCase(otherInstitution); if (isEqualLastName && isEqualFirstName && !isEqualInstitution) { prioritizeInstitution(this, otherAuthor); isEqualInstitution = true; } isEqual = isEqualLastName && isEqualFirstName && isEqualInstitution; } else if ((this.getOrigin() == Category.INCITES && otherAuthor.getOrigin() == Category.FACULTY) || (this.getOrigin() == Category.FACULTY && otherAuthor.getOrigin() == Category.INCITES)) { isEqualLastName = this.getLastName().equalsIgnoreCase(otherAuthor.getLastName()); isEqualFirstName = this.isSameFirstName(otherAuthor.getFirstName()); isEqual = isEqualLastName && isEqualFirstName; if (isEqual) { otherAuthor.setIdenfitication(true); } } else if (this.getOrigin() == Category.PUBMED && otherAuthor.getOrigin() == Category.PUBMED || this.getOrigin() == Category.SCOPUS && otherAuthor.getOrigin() == Category.SCOPUS) { isEqualLastName = this.getLastName().equalsIgnoreCase(otherAuthor.getLastName()); isEqualFirstName = this.getFirstInitial().equalsIgnoreCase(otherAuthor.getFirstInitial()); isEqual = isEqualFirstName && isEqualLastName; } return isEqual; }
Author extends AbstractNode { @Override public boolean equals(Object other) { Author otherAuthor = (Author) other; boolean isEqual = false, isEqualFirstName = false, isEqualLastName = false; if (this.getOrigin() == Category.INCITES && otherAuthor.getOrigin() == Category.INCITES) { boolean isEqualInstitution = false; isEqualLastName = this.getLastName().equalsIgnoreCase(otherAuthor.getLastName()); isEqualFirstName = this.isSameFirstName(otherAuthor.getFirstName()); String myInstitution = this.getInstitution(), otherInstitution = otherAuthor.getInstitution(); isEqualInstitution = myInstitution.equalsIgnoreCase(otherInstitution); if (isEqualLastName && isEqualFirstName && !isEqualInstitution) { prioritizeInstitution(this, otherAuthor); isEqualInstitution = true; } isEqual = isEqualLastName && isEqualFirstName && isEqualInstitution; } else if ((this.getOrigin() == Category.INCITES && otherAuthor.getOrigin() == Category.FACULTY) || (this.getOrigin() == Category.FACULTY && otherAuthor.getOrigin() == Category.INCITES)) { isEqualLastName = this.getLastName().equalsIgnoreCase(otherAuthor.getLastName()); isEqualFirstName = this.isSameFirstName(otherAuthor.getFirstName()); isEqual = isEqualLastName && isEqualFirstName; if (isEqual) { otherAuthor.setIdenfitication(true); } } else if (this.getOrigin() == Category.PUBMED && otherAuthor.getOrigin() == Category.PUBMED || this.getOrigin() == Category.SCOPUS && otherAuthor.getOrigin() == Category.SCOPUS) { isEqualLastName = this.getLastName().equalsIgnoreCase(otherAuthor.getLastName()); isEqualFirstName = this.getFirstInitial().equalsIgnoreCase(otherAuthor.getFirstInitial()); isEqual = isEqualFirstName && isEqualLastName; } return isEqual; } }
Author extends AbstractNode { @Override public boolean equals(Object other) { Author otherAuthor = (Author) other; boolean isEqual = false, isEqualFirstName = false, isEqualLastName = false; if (this.getOrigin() == Category.INCITES && otherAuthor.getOrigin() == Category.INCITES) { boolean isEqualInstitution = false; isEqualLastName = this.getLastName().equalsIgnoreCase(otherAuthor.getLastName()); isEqualFirstName = this.isSameFirstName(otherAuthor.getFirstName()); String myInstitution = this.getInstitution(), otherInstitution = otherAuthor.getInstitution(); isEqualInstitution = myInstitution.equalsIgnoreCase(otherInstitution); if (isEqualLastName && isEqualFirstName && !isEqualInstitution) { prioritizeInstitution(this, otherAuthor); isEqualInstitution = true; } isEqual = isEqualLastName && isEqualFirstName && isEqualInstitution; } else if ((this.getOrigin() == Category.INCITES && otherAuthor.getOrigin() == Category.FACULTY) || (this.getOrigin() == Category.FACULTY && otherAuthor.getOrigin() == Category.INCITES)) { isEqualLastName = this.getLastName().equalsIgnoreCase(otherAuthor.getLastName()); isEqualFirstName = this.isSameFirstName(otherAuthor.getFirstName()); isEqual = isEqualLastName && isEqualFirstName; if (isEqual) { otherAuthor.setIdenfitication(true); } } else if (this.getOrigin() == Category.PUBMED && otherAuthor.getOrigin() == Category.PUBMED || this.getOrigin() == Category.SCOPUS && otherAuthor.getOrigin() == Category.SCOPUS) { isEqualLastName = this.getLastName().equalsIgnoreCase(otherAuthor.getLastName()); isEqualFirstName = this.getFirstInitial().equalsIgnoreCase(otherAuthor.getFirstInitial()); isEqual = isEqualFirstName && isEqualLastName; } return isEqual; } Author(String rawAuthorText, int origin);  Author(String rawAuthorText, int origin, IncitesInstitutionLocationMap locationMap); }
Author extends AbstractNode { @Override public boolean equals(Object other) { Author otherAuthor = (Author) other; boolean isEqual = false, isEqualFirstName = false, isEqualLastName = false; if (this.getOrigin() == Category.INCITES && otherAuthor.getOrigin() == Category.INCITES) { boolean isEqualInstitution = false; isEqualLastName = this.getLastName().equalsIgnoreCase(otherAuthor.getLastName()); isEqualFirstName = this.isSameFirstName(otherAuthor.getFirstName()); String myInstitution = this.getInstitution(), otherInstitution = otherAuthor.getInstitution(); isEqualInstitution = myInstitution.equalsIgnoreCase(otherInstitution); if (isEqualLastName && isEqualFirstName && !isEqualInstitution) { prioritizeInstitution(this, otherAuthor); isEqualInstitution = true; } isEqual = isEqualLastName && isEqualFirstName && isEqualInstitution; } else if ((this.getOrigin() == Category.INCITES && otherAuthor.getOrigin() == Category.FACULTY) || (this.getOrigin() == Category.FACULTY && otherAuthor.getOrigin() == Category.INCITES)) { isEqualLastName = this.getLastName().equalsIgnoreCase(otherAuthor.getLastName()); isEqualFirstName = this.isSameFirstName(otherAuthor.getFirstName()); isEqual = isEqualLastName && isEqualFirstName; if (isEqual) { otherAuthor.setIdenfitication(true); } } else if (this.getOrigin() == Category.PUBMED && otherAuthor.getOrigin() == Category.PUBMED || this.getOrigin() == Category.SCOPUS && otherAuthor.getOrigin() == Category.SCOPUS) { isEqualLastName = this.getLastName().equalsIgnoreCase(otherAuthor.getLastName()); isEqualFirstName = this.getFirstInitial().equalsIgnoreCase(otherAuthor.getFirstInitial()); isEqual = isEqualFirstName && isEqualLastName; } return isEqual; } Author(String rawAuthorText, int origin);  Author(String rawAuthorText, int origin, IncitesInstitutionLocationMap locationMap); void addInstitution(String institution); void addPublication(Publication publication); double getExpectedCitations(); @Override boolean equals(Object other); void format(); @Override CyNode getCyNode(); String getDepartment(); String getFirstInitial(); String getFirstName(); String getInstitution(); List<String> getInstitutions(); @Override String getLabel(); String getLastName(); String getLocation(); String getMainInstitution(); @Override Map<String, Object> getNodeAttrMap(); int getOrigin(); List<String> getPubList(); int getTimesCited(); boolean hasAlreadyBeenAdded(); @Override int hashCode(); boolean isIdentified(); void prioritizeInstitution(Author author, Author otherAuthor); void setAlreadyBeenAdded(boolean alreadyBeenAdded); @Override void setCyNode(CyNode cyNode); void setDepartment(String department); void setFirstInitial(String firstInitial); void setFirstName(String firstName); @Override void setLabel(String label); void setLastName(String lastName); void setLocation(String location); void setMainInstitution(String mainInstitution); void setMiddleInitial(String middleInitial); @Override void setNodeAttrMap(Map<String, Object> attrMap); void setOrigin(int origin); void setPubList(List<String> pubList); void setTimesCited(int timesCited); @Override String toString(); }
Author extends AbstractNode { @Override public boolean equals(Object other) { Author otherAuthor = (Author) other; boolean isEqual = false, isEqualFirstName = false, isEqualLastName = false; if (this.getOrigin() == Category.INCITES && otherAuthor.getOrigin() == Category.INCITES) { boolean isEqualInstitution = false; isEqualLastName = this.getLastName().equalsIgnoreCase(otherAuthor.getLastName()); isEqualFirstName = this.isSameFirstName(otherAuthor.getFirstName()); String myInstitution = this.getInstitution(), otherInstitution = otherAuthor.getInstitution(); isEqualInstitution = myInstitution.equalsIgnoreCase(otherInstitution); if (isEqualLastName && isEqualFirstName && !isEqualInstitution) { prioritizeInstitution(this, otherAuthor); isEqualInstitution = true; } isEqual = isEqualLastName && isEqualFirstName && isEqualInstitution; } else if ((this.getOrigin() == Category.INCITES && otherAuthor.getOrigin() == Category.FACULTY) || (this.getOrigin() == Category.FACULTY && otherAuthor.getOrigin() == Category.INCITES)) { isEqualLastName = this.getLastName().equalsIgnoreCase(otherAuthor.getLastName()); isEqualFirstName = this.isSameFirstName(otherAuthor.getFirstName()); isEqual = isEqualLastName && isEqualFirstName; if (isEqual) { otherAuthor.setIdenfitication(true); } } else if (this.getOrigin() == Category.PUBMED && otherAuthor.getOrigin() == Category.PUBMED || this.getOrigin() == Category.SCOPUS && otherAuthor.getOrigin() == Category.SCOPUS) { isEqualLastName = this.getLastName().equalsIgnoreCase(otherAuthor.getLastName()); isEqualFirstName = this.getFirstInitial().equalsIgnoreCase(otherAuthor.getFirstInitial()); isEqual = isEqualFirstName && isEqualLastName; } return isEqual; } Author(String rawAuthorText, int origin);  Author(String rawAuthorText, int origin, IncitesInstitutionLocationMap locationMap); void addInstitution(String institution); void addPublication(Publication publication); double getExpectedCitations(); @Override boolean equals(Object other); void format(); @Override CyNode getCyNode(); String getDepartment(); String getFirstInitial(); String getFirstName(); String getInstitution(); List<String> getInstitutions(); @Override String getLabel(); String getLastName(); String getLocation(); String getMainInstitution(); @Override Map<String, Object> getNodeAttrMap(); int getOrigin(); List<String> getPubList(); int getTimesCited(); boolean hasAlreadyBeenAdded(); @Override int hashCode(); boolean isIdentified(); void prioritizeInstitution(Author author, Author otherAuthor); void setAlreadyBeenAdded(boolean alreadyBeenAdded); @Override void setCyNode(CyNode cyNode); void setDepartment(String department); void setFirstInitial(String firstInitial); void setFirstName(String firstName); @Override void setLabel(String label); void setLastName(String lastName); void setLocation(String location); void setMainInstitution(String mainInstitution); void setMiddleInitial(String middleInitial); @Override void setNodeAttrMap(Map<String, Object> attrMap); void setOrigin(int origin); void setPubList(List<String> pubList); void setTimesCited(int timesCited); @Override String toString();  }