Exemple #1
0
  @Override
  public Object getReducedValue(
      final Object ctx, final Object thisValue, final VariableResolverFactory factory) {
    try {
      final String i = String.valueOf(soundslike.getReducedValue(ctx, thisValue, factory));
      if (i == null) {
        throw new ClassCastException();
      }

      final String x = (String) stmt.getReducedValue(ctx, thisValue, factory);
      if (x == null) {
        throw new CompileException("not a string: " + stmt.getName(), stmt.getExpr(), getStart());
      }

      return similarity(i, x);
    } catch (final ClassCastException e) {
      throw new CompileException(
          "not a string: " + soundslike.getName(), soundslike.getExpr(), soundslike.getStart());
    }
  }