Examples of TypeRegistry


Examples of com.facebook.presto.type.TypeRegistry

    @BeforeMethod(alwaysRun = true)
    public void setup()
            throws Exception
    {
        MetadataManager metadata = new MetadataManager(new FeaturesConfig().setExperimentalSyntaxEnabled(true), new TypeRegistry(), new SystemTablesMetadata());
        metadata.addConnectorMetadata("tpch", "tpch", new TestingMetadata());
        metadata.addConnectorMetadata("c2", "c2", new TestingMetadata());
        metadata.addConnectorMetadata("c3", "c3", new TestingMetadata());

        SchemaTableName table1 = new SchemaTableName("default", "t1");
View Full Code Here

Examples of com.tinkerpop.frames.modules.typedgraph.TypeRegistry

import com.tinkerpop.frames.modules.typedgraph.TypeValue;

public class TypeRegistryTest {
  @Test(expected = IllegalArgumentException.class) public void noAnotations() {
    //You can't register interfaces when there is no @TypeField on it or on any of the parents:
    new TypeRegistry().add(Empty.class);
  }
View Full Code Here

Examples of org.jfree.formula.typing.TypeRegistry

      final Type paramType = function.metaData.getParameterType(pos);
      if (parameter != null)
      {
        final TypeValuePair result = parameter.evaluate();
        // lets do some type checking, right?
        final TypeRegistry typeRegistry = function.getContext().getTypeRegistry();
        final TypeValuePair converted = typeRegistry.convertTo(paramType, result);
        if (converted == null)
        {
          Log.debug("Failed to evaluate parameter " + pos + " on function " + function);
          throw new EvaluationException(LibFormulaErrorValue.ERROR_INVALID_AUTO_ARGUMENT_VALUE);
        }
View Full Code Here

Examples of org.pentaho.reporting.libraries.formula.typing.TypeRegistry

    }
    if (parameters.getParameterCount() > 3)
    {
      throw EvaluationException.getInstance(LibFormulaErrorValue.ERROR_ARGUMENTS_VALUE);
    }
    final TypeRegistry typeRegistry = context.getTypeRegistry();
    final String urlText = typeRegistry.convertToText(parameters.getType(0), parameters.getValue(0));
    if (urlText == null)
    {
      throw EvaluationException.getInstance(LibFormulaErrorValue.ERROR_ARGUMENTS_VALUE);
    }
    String tabText = null;
    if (parameters.getParameterCount() > 1)
    {
      tabText = typeRegistry.convertToText(parameters.getType(1), parameters.getValue(1));
    }

    final ReportFormulaContext rfc = (ReportFormulaContext) context;
    if (StringUtils.isEmpty(tabText))
    {
      final DocumentMetaData documentMetaData = rfc.getProcessingContext().getDocumentMetaData();
      tabText = (String) documentMetaData.getBundleAttribute
          (ODFMetaAttributeNames.DublinCore.NAMESPACE, ODFMetaAttributeNames.DublinCore.TITLE);
      if (StringUtils.isEmpty(tabText))
      {
        final Object o = rfc.getDataRow().get("report.name");
        if (o != null)
        {
          tabText = String.valueOf(o);
        }
      }
      if (StringUtils.isEmpty(tabText))
      {
        final ResourceBundle bundle = ResourceBundle.getBundle
            ("org.pentaho.reporting.engine.classic.extensions.drilldown.messages");
        tabText = bundle.getString("UnnamedTab");
      }
    }

    final boolean tabActive;
    if (parameters.getParameterCount() == 3)
    {
      if (Boolean.FALSE.equals(typeRegistry.convertToLogical(parameters.getType(2), parameters.getValue(2))))
      {
        tabActive = false;
      }
      else
      {
View Full Code Here

Examples of org.pentaho.reporting.libraries.formula.typing.TypeRegistry

    // 0: Configuration-indicator (gives the pattern indirectly) never the pattern itself
    // 1: the report-path
    // 2: the parameter as 2d-array (name value pairs)

    final TypeRegistry typeRegistry = context.getTypeRegistry();
    final String configIndicator = typeRegistry.convertToText(parameters.getType(0), parameters.getValue(0));
    String path;
    try
    {
      path = typeRegistry.convertToText(parameters.getType(1), parameters.getValue(1));
    }
    catch (EvaluationException ee)
    {
      if (LibFormulaErrorValue.ERROR_NA_VALUE.equals(ee.getErrorValue()))
      {
        path = null;
      }
      else
      {
        throw ee;
      }
    }
    final ArrayCallback parameter = typeRegistry.convertToArray(parameters.getType(2), parameters.getValue(2));

    final LinkCustomizer pattern = createLinkCustomizer(configIndicator);
    return new TypeValuePair(TextType.TYPE, pattern.format(context, configIndicator, path,
        computeParameterEntries(parameter, typeRegistry)));
  }
View Full Code Here

Examples of org.pentaho.reporting.libraries.formula.typing.TypeRegistry

    if (parameterCount < 1)
    {
      throw EvaluationException.getInstance(LibFormulaErrorValue.ERROR_ARGUMENTS_VALUE);
    }

    final TypeRegistry typeRegistry = context.getTypeRegistry();
    final double value = typeRegistry.convertToNumber(parameters.getType(0), parameters.getValue(0)).doubleValue();
    boolean fixedSize = false;
    int precision = 0;

    // Value == 0? return
    if(value == 0)
        return new TypeValuePair(TextType.TYPE, "0");

    if (parameters.getParameterCount() > 1)
    {
      fixedSize = true;
      precision = typeRegistry.convertToNumber(parameters.getType(1), parameters.getValue(1)).intValue();
      if (parameters.getParameterCount() == 3)
      {
        final Boolean rawFixedSize = typeRegistry.convertToLogical(parameters.getType(2), parameters.getValue(2));
        fixedSize = rawFixedSize.booleanValue();
      }
    }

    final int log10 = computeLog10(value);
View Full Code Here

Examples of org.pentaho.reporting.libraries.formula.typing.TypeRegistry

  public final TypeValuePair evaluate(final FormulaContext context,
                                      final TypeValuePair value1,
                                      final TypeValuePair value2)
      throws EvaluationException
  {
    final TypeRegistry typeRegistry = context.getTypeRegistry();
    final Type type1 = value1.getType();
    final Type type2 = value2.getType();
    final Object value1Raw = value1.getValue();
    final Object value2Raw = value2.getValue();
    if (value1Raw == null || value2Raw == null)
    {
      throw EvaluationException.getInstance(LibFormulaErrorValue.ERROR_NA_VALUE);
    }

    final ExtendedComparator comparator = typeRegistry.getComparator(type1, type2);
    final int result = comparator.compare (type1, value1Raw, type2, value2Raw);
    if (evaluate(result))
    {
      return RETURN_TRUE;
    }
View Full Code Here

Examples of org.pentaho.reporting.libraries.formula.typing.TypeRegistry

  public TypeValuePair evaluate(final FormulaContext context,
                                final TypeValuePair value1, final TypeValuePair value2)
      throws EvaluationException
  {
    final TypeRegistry typeRegistry = context.getTypeRegistry();

    final ExtendedComparator comparator =
        typeRegistry.getComparator(value1.getType(), value2.getType());
    final boolean result = comparator.isEqual
        (value1.getType(), value1.getValue(),
            value2.getType(), value2.getValue());

    if (result == false)
View Full Code Here

Examples of org.pentaho.reporting.libraries.formula.typing.TypeRegistry

  public final TypeValuePair evaluate(final FormulaContext context,
                                      final TypeValuePair value1,
                                      final TypeValuePair value2)
      throws EvaluationException
  {
    final TypeRegistry typeRegistry = context.getTypeRegistry();

    if (value1 == null || value2 == null)
    {
      // If this happens, then one of the implementations has messed up.
      throw EvaluationException.getInstance(LibFormulaErrorValue.ERROR_UNEXPECTED_VALUE);
View Full Code Here

Examples of org.pentaho.reporting.libraries.formula.typing.TypeRegistry

    {
      throw EvaluationException.getInstance(LibFormulaErrorValue.ERROR_NA_VALUE);
    }

    final Type type = value1.getType();
    final TypeRegistry typeRegistry = context.getTypeRegistry();

    if (type.isFlagSet(Type.NUMERIC_TYPE) == false &&
        type.isFlagSet(Type.ANY_TYPE) == false)
    {
      throw EvaluationException.getInstance(LibFormulaErrorValue.ERROR_INVALID_ARGUMENT_VALUE);
    }

    // return the same as zero minus value.
    final Number number = typeRegistry.convertToNumber(type, rawValue);
    final BigDecimal value = NumberUtil.getAsBigDecimal(number);
    final BigDecimal percentage = NumberUtil.divide(value, HUNDRED);
    return new TypeValuePair(NumberType.GENERIC_NUMBER, percentage);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.