private boolean isSameStructure ( INode source , INode target ) { boolean result = false ; if ( null != source && null != target ) { if ( source . getChildrenList ( ) != null && target . getChildrenList ( ) != null ) { int sourceChildren = source . getChildrenList ( ) . size ( ) ; int targetChildren = target . getChildrenList ( ) . size ( ) ; if ( sourceChildren == 0 && targetChildren == 0 ) { result = true ; } else if ( sourceChildren > 0 && targetChildren > 0 ) { result = true ; } } else if ( source . getChildrenList ( ) == null && target . getChildrenList ( ) == null ) { result = true ; } } else if ( null == source && null == target ) { result = true ; } return result ; }
Checks if source and target are structural preserving this is function to function and argument to argument match .