Rename numberOfChildren and Remove bug from equals

numberOfChildren() method renamed to getNumberOfChildren()

An extra null checking condition has been added before checking
the values of the node itself in order to prevent
NullPointerExceptions from being thrown. This bug has been spotted
while doing extensive testing of the equals method