package lectures.equals_polymorphism_overloading;
import util.annotations.WebDocuments;
import lectures.inheritance.ABaseStringHistory;
import lectures.inheritance.BaseStringHistory;;
@WebDocuments({"Lectures/EqualsPolymorphismOverloading.pptx", "Lectures/EqualsPolymorphismOverloading.pdf", "Videos/EqualsPolymorphismOverloading.avi"})
public class AStringHistoryWithCustomEquals extends ABaseStringHistory implements StringHistoryWithCustomEquals {
public boolean equals(BaseStringHistory otherStringHistory) {
if (size != otherStringHistory.size())
return false;
for (int index = 0; index < size; index++)
if (!contents[index].equals(otherStringHistory.elementAt(index)))
return false;
return true;
}
public boolean equals(Object otherObject) {
System.out.println("Equals with Object Parameter Called");
if (!(otherObject instanceof BaseStringHistory)) return false;
return equals((BaseStringHistory) otherObject);
}
}