Package org.jfree.formula.lvalues

Examples of org.jfree.formula.lvalues.TypeValuePair


    final Calendar gc = DateUtil.createCalendar(d, context
        .getLocalizationContext());

    final int month = gc.get(Calendar.MONTH) + 1;
    return new TypeValuePair(NumberType.GENERIC_NUMBER, new Integer(month));
  }
View Full Code Here


    }
    try
    {
      if (encodingResult == null)
      {
        return new TypeValuePair
            (TextType.TYPE, URLEncoder.encode(textResult, "ISO-8859-1"));
      }
      return new TypeValuePair
          (TextType.TYPE, URLEncoder.encode(textResult, encodingResult));

    }
    catch(UnsupportedEncodingException use)
    {
View Full Code Here

    final Calendar gc = DateUtil.createCalendar(d, context
        .getLocalizationContext());

    final int dayOfMonth = gc
            .get(Calendar.DAY_OF_MONTH);
    return new TypeValuePair(NumberType.GENERIC_NUMBER, new Integer(dayOfMonth));
  }
View Full Code Here

    if(result == null)
    {
      throw new EvaluationException(LibFormulaErrorValue.ERROR_INVALID_ARGUMENT_VALUE);
    }

    return new TypeValuePair(NumberType.GENERIC_NUMBER, new BigDecimal(result.length()));
  }
View Full Code Here

    final LocalizationContext localizationContext = context
        .getLocalizationContext();
    final Time time = DateUtil.createTime(hours, minutes, seconds,
        localizationContext);

    return new TypeValuePair(DateTimeType.TIME_TYPE, time);
  }
View Full Code Here

    if(length.doubleValue() < 0 || start.doubleValue() < 1)
    {
      throw new EvaluationException(LibFormulaErrorValue.ERROR_INVALID_ARGUMENT_VALUE);
    }

    return new TypeValuePair(TextType.TYPE, process(text, start, length));
  }
View Full Code Here

    {
      n = new BigDecimal(result.toString());
    }
    final Integer ret = NumberUtil.performIntRounding(n);

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

    if(result == null)
    {
      throw new EvaluationException(LibFormulaErrorValue.ERROR_INVALID_ARGUMENT_VALUE);
    }

    return new TypeValuePair(TextType.TYPE, result.toUpperCase(context.getLocalizationContext().getLocale()));
  }
View Full Code Here

    final Type type1 = parameters.getType(0);
    final Object value1 = parameters.getValue(0);

    if(type1 instanceof TextType || value1 instanceof String)
    {
      return new TypeValuePair(TextType.TYPE, value1);
    }
    else
    {
      return EMPTY_STRING;
    }
View Full Code Here

  {
    // we expect strings and will check, whether the reference for theses
    // strings is dirty.
    if (context instanceof ReportFormulaContext == false)
    {
      return new TypeValuePair(ErrorType.TYPE, new LibFormulaErrorValue
          (LibFormulaErrorValue.ERROR_REFERENCE_NOT_RESOLVABLE));
    }

    final ReportFormulaContext reportFormulaContext =
        (ReportFormulaContext) context;
    Object declaringElement = reportFormulaContext.getDeclaringElement();
    if (declaringElement instanceof Element == false)
    {
      return new TypeValuePair(ErrorType.TYPE, new LibFormulaErrorValue
          (LibFormulaErrorValue.ERROR_REFERENCE_NOT_RESOLVABLE));
    }

    final Element element = (Element) declaringElement;

    if (parameters.getParameterCount() == 1)
    {
      final String value = (String) parameters.getValue(0);
      return new TypeValuePair(AnyType.TYPE, element.getAttribute(value));
    }
    else if (parameters.getParameterCount() == 2)
    {
      final String namespace = (String) parameters.getValue(0);
      final String attrName = (String) parameters.getValue(1);
      return new TypeValuePair(AnyType.TYPE,
          element.getAttribute(namespace, attrName));
    }
    return new TypeValuePair(ErrorType.TYPE, new LibFormulaErrorValue
        (LibFormulaErrorValue.ERROR_INVALID_ARGUMENT));
  }
View Full Code Here

TOP

Related Classes of org.jfree.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.