refactoring size and isTerminal method in LappingObject.java