implement the generic patterngenerator