PatternGroup.prototype.addPattern = function(pattern) {
  if (this.patterns.indexOf(pattern) === -1) this.patterns.push(pattern);
};