add toPatternAsString method, toByAsString method