Implemented equals and hashCode for Shape class.