Package org.pentaho.reporting.libraries.formula.lvalues

Examples of org.pentaho.reporting.libraries.formula.lvalues.TypeValuePair


        if (sequence.hasNext())
        {
          b.append(separator);
        }
      }
      return new TypeValuePair(TextType.TYPE, b.toString());
    }
    else
    {
      final CSVQuoter quoter = new CSVQuoter(quote.charAt(0), quote.charAt(0), true);
      StringBuilder b = new StringBuilder();
      while (sequence.hasNext())
      {
        final Object o = sequence.next();
        if (o != null)
        {
          b.append(quoter.doQuoting(String.valueOf(o)));
        }
        if (sequence.hasNext())
        {
          b.append(separator);
        }
      }
      return new TypeValuePair(TextType.TYPE, b.toString());
    }
  }
View Full Code Here


    int s = text.length()-length +1;
    if(s < 1)
    {
      s = 1;
    }
    return new TypeValuePair(TextType.TYPE, MidFunction.process(text, s, length));
  }
View Full Code Here

    final BigDecimal day = new BigDecimal(NumberUtil.performIntRounding(bd).intValue());
    final BigDecimal dayFraction = bd.subtract(day);

    final BigDecimal hourAndMinutesVal = dayFraction.multiply(HOUR_24);
    final BigDecimal hours = NumberUtil.performIntRounding(hourAndMinutesVal);
    return new TypeValuePair(NumberType.GENERIC_NUMBER, hours);
  }
View Full Code Here

    try
    {
      final SimpleDateFormat sdf = new SimpleDateFormat(pattern, locale);
      sdf.setTimeZone(timeZone);
      sdf.setLenient(false);
      return new TypeValuePair(DateTimeType.DATETIME_TYPE, sdf.parse(dateString));
    }
    catch (Exception e)
    {
      throw EvaluationException.getInstance(LibFormulaErrorValue.ERROR_UNEXPECTED_VALUE);
    }
View Full Code Here

  {
  }

  public TypeValuePair evaluate(final FormulaContext context, final ParameterCallback parameters) throws EvaluationException
  {
    final TypeValuePair typeValuePair = super.evaluate(context, parameters);
    if(typeValuePair.getValue().equals(Boolean.TRUE))
    {
      return RETURN_FALSE;
    }
    else
    {
View Full Code Here

    else
    {
      trimmedResult = b.toString();
    }

    return new TypeValuePair(TextType.TYPE, trimmedResult);
  }
View Full Code Here

      encodingResult = context.getConfiguration().getConfigProperty
          ("org.pentaho.reporting.libraries.formula.URLEncoding", "UTF-8");
    }
    try
    {
      return new TypeValuePair
          (TextType.TYPE, URLEncoder.encode(textResult, encodingResult));

    }
    catch(final UnsupportedEncodingException use)
    {
View Full Code Here

        final LValue rawValue = sequence.nextRawValue();
        if (rawValue == null)
        {
          throw EvaluationException.getInstance(LibFormulaErrorValue.ERROR_INVALID_ARGUMENT_VALUE);
        }
        final TypeValuePair nextValue = rawValue.evaluate();
        final Number number = typeRegistry.convertToNumber(nextValue.getType(), nextValue.getValue());
        final BigDecimal next = NumberUtil.getAsBigDecimal(number);

        if(last == null)
        {
          last = next;
        }
        else
        {
          if(last.compareTo(next) == 1)
          {
            last = next;
          }
        }
      }
    }
    if(last == null)
    {
      throw EvaluationException.getInstance(LibFormulaErrorValue.ERROR_INVALID_ARGUMENT_VALUE);
    }

    return new TypeValuePair(NumberType.GENERIC_NUMBER, last);
  }
View Full Code Here

      workingCalandar.set(Calendar.YEAR, i);
      res += workingCalandar.getActualMaximum(Calendar.DAY_OF_YEAR);
    }

    //noinspection UnpredictableBigDecimalConstructorCall
    return new TypeValuePair(NumberType.GENERIC_NUMBER, new BigDecimal((double)res));
  }
View Full Code Here

    for (int i = 0; i < chars.length; i++)
    {
      final char c = chars[i];
      convert(c, b);
    }
    return new TypeValuePair(TextType.TYPE, b.toString());

  }
View Full Code Here

TOP

Related Classes of org.pentaho.reporting.libraries.formula.lvalues.TypeValuePair

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.