class AviatorPattern extends AviatorObject {


  private static final long serialVersionUID = -6667072156431636239L;
  final Pattern pattern;


  public AviatorPattern(final String expression) {
    super();
    this.pattern = Pattern.compile(expression);
  }


  public AviatorPattern(final Pattern pattern) {
    super();
    this.pattern = pattern;
  }


  public Pattern getPattern() {
    return this.pattern;
  }


  @Override
  public AviatorObject add(final AviatorObject other, final Map<String, Object> env) {<FILL_FUNCTION_BODY>}


  @Override
  public AviatorObject match(final AviatorObject other, final Map<String, Object> env) {
    switch (other.getAviatorType()) {
      case Nil:
        return AviatorBoolean.FALSE;
      case String:
        AviatorString aviatorString = (AviatorString) other;
        Matcher m = this.pattern.matcher(aviatorString.getLexeme(env));
        if (m.matches()) {
          boolean captureGroups = RuntimeUtils.getInstance(env)
              .getOptionValue(Options.PUT_CAPTURING_GROUPS_INTO_ENV).bool;
          if (captureGroups && env != Collections.EMPTY_MAP) {
            int groupCount = m.groupCount();
            for (int i = 0; i <= groupCount; i++) {
              ((Env) env).override("$" + i, m.group(i));
            }
          }
          return AviatorBoolean.TRUE;
        } else {
          return AviatorBoolean.FALSE;
        }
      case JavaType:
        AviatorJavaType javaType = (AviatorJavaType) other;
        final Object javaValue = javaType.getValue(env);
        if (javaValue == null) {
          return AviatorBoolean.FALSE;
        }
        if (TypeUtils.isString(javaValue)) {
          return match(new AviatorString(String.valueOf(javaValue)), env);
        } else {
          throw new ExpressionRuntimeException(desc(env) + " could not match " + other.desc(env));
        }
      default:
        throw new ExpressionRuntimeException(desc(env) + " could not match " + other.desc(env));
    }

  }


  @Override
  public int innerCompare(final AviatorObject other, final Map<String, Object> env) {
    if (this == other) {
      return 0;
    }
    switch (other.getAviatorType()) {
      case Pattern:
        return this.pattern.pattern().compareTo(((AviatorPattern) other).pattern.pattern());
      case JavaType:
        if (other.getValue(env) == null) {
          return 1;
        } else {
          throw new CompareNotSupportedException(
              "Could not compare Pattern with " + other.desc(env));
        }
      case Nil:
        return 1;
      default:
        throw new CompareNotSupportedException("Could not compare Pattern with " + other.desc(env));
    }
  }


  @Override
  public AviatorType getAviatorType() {
    return AviatorType.Pattern;
  }


  @Override
  public Object getValue(final Map<String, Object> env) {
    return this.pattern;
  }

}

    switch (other.getAviatorType()) {
      case String:
        return new AviatorString(this.pattern.pattern() + ((AviatorString) other).getLexeme(env));
      case JavaType:
        AviatorJavaType javaType = (AviatorJavaType) other;
        final Object otherValue = javaType.getValue(env);
        if (TypeUtils.isString(otherValue)) {
          return new AviatorString(this.pattern.pattern() + otherValue.toString());
        } else {
          return super.add(other, env);
        }
      default:
        return super.add(other, env);

    }
  
<methods>public non-sealed void <init>() ,public com.googlecode.aviator.runtime.type.AviatorObject add(com.googlecode.aviator.runtime.type.AviatorObject, Map<java.lang.String,java.lang.Object>) ,public com.googlecode.aviator.runtime.type.AviatorObject bitAnd(com.googlecode.aviator.runtime.type.AviatorObject, Map<java.lang.String,java.lang.Object>) ,public com.googlecode.aviator.runtime.type.AviatorObject bitNot(Map<java.lang.String,java.lang.Object>) ,public com.googlecode.aviator.runtime.type.AviatorObject bitOr(com.googlecode.aviator.runtime.type.AviatorObject, Map<java.lang.String,java.lang.Object>) ,public com.googlecode.aviator.runtime.type.AviatorObject bitXor(com.googlecode.aviator.runtime.type.AviatorObject, Map<java.lang.String,java.lang.Object>) ,public boolean booleanValue(Map<java.lang.String,java.lang.Object>) ,public int compare(com.googlecode.aviator.runtime.type.AviatorObject, Map<java.lang.String,java.lang.Object>) ,public int compareEq(com.googlecode.aviator.runtime.type.AviatorObject, Map<java.lang.String,java.lang.Object>) ,public com.googlecode.aviator.runtime.type.AviatorObject defineValue(com.googlecode.aviator.runtime.type.AviatorObject, Map<java.lang.String,java.lang.Object>) ,public com.googlecode.aviator.runtime.type.AviatorObject deref(Map<java.lang.String,java.lang.Object>) ,public java.lang.String desc(Map<java.lang.String,java.lang.Object>) ,public com.googlecode.aviator.runtime.type.AviatorObject div(com.googlecode.aviator.runtime.type.AviatorObject, Map<java.lang.String,java.lang.Object>) ,public com.googlecode.aviator.runtime.type.AviatorObject exponent(com.googlecode.aviator.runtime.type.AviatorObject, Map<java.lang.String,java.lang.Object>) ,public abstract com.googlecode.aviator.runtime.type.AviatorType getAviatorType() ,public com.googlecode.aviator.runtime.type.AviatorObject getElement(Map<java.lang.String,java.lang.Object>, com.googlecode.aviator.runtime.type.AviatorObject) ,public Map<java.lang.Object,java.lang.Object> getMetadata() ,public abstract java.lang.Object getValue(Map<java.lang.String,java.lang.Object>) ,public abstract int innerCompare(com.googlecode.aviator.runtime.type.AviatorObject, Map<java.lang.String,java.lang.Object>) ,public boolean isNull(Map<java.lang.String,java.lang.Object>) ,public com.googlecode.aviator.runtime.type.AviatorObject match(com.googlecode.aviator.runtime.type.AviatorObject, Map<java.lang.String,java.lang.Object>) ,public java.lang.Object meta(java.lang.Object) ,public com.googlecode.aviator.runtime.type.AviatorObject mod(com.googlecode.aviator.runtime.type.AviatorObject, Map<java.lang.String,java.lang.Object>) ,public com.googlecode.aviator.runtime.type.AviatorObject mult(com.googlecode.aviator.runtime.type.AviatorObject, Map<java.lang.String,java.lang.Object>) ,public com.googlecode.aviator.runtime.type.AviatorObject neg(Map<java.lang.String,java.lang.Object>) ,public com.googlecode.aviator.runtime.type.AviatorObject not(Map<java.lang.String,java.lang.Object>) ,public java.lang.Number numberValue(Map<java.lang.String,java.lang.Object>) ,public com.googlecode.aviator.runtime.type.AviatorObject setValue(com.googlecode.aviator.runtime.type.AviatorObject, Map<java.lang.String,java.lang.Object>) ,public com.googlecode.aviator.runtime.type.AviatorObject shiftLeft(com.googlecode.aviator.runtime.type.AviatorObject, Map<java.lang.String,java.lang.Object>) ,public com.googlecode.aviator.runtime.type.AviatorObject shiftRight(com.googlecode.aviator.runtime.type.AviatorObject, Map<java.lang.String,java.lang.Object>) ,public java.lang.String stringValue(Map<java.lang.String,java.lang.Object>) ,public com.googlecode.aviator.runtime.type.AviatorObject sub(com.googlecode.aviator.runtime.type.AviatorObject, Map<java.lang.String,java.lang.Object>) ,public java.lang.String toString() ,public com.googlecode.aviator.runtime.type.AviatorObject unsignedShiftRight(com.googlecode.aviator.runtime.type.AviatorObject, Map<java.lang.String,java.lang.Object>) ,public com.googlecode.aviator.runtime.type.AviatorObject withMeta(java.lang.Object, java.lang.Object) ,public com.googlecode.aviator.runtime.type.AviatorObject withoutMeta(java.lang.Object) <variables>protected Map<java.lang.Object,java.lang.Object> metadata,private static final long serialVersionUID