• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java LibFormulaErrorValue类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.pentaho.reporting.libraries.formula.LibFormulaErrorValue的典型用法代码示例。如果您正苦于以下问题:Java LibFormulaErrorValue类的具体用法?Java LibFormulaErrorValue怎么用?Java LibFormulaErrorValue使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



LibFormulaErrorValue类属于org.pentaho.reporting.libraries.formula包,在下文中一共展示了LibFormulaErrorValue类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: evaluate

import org.pentaho.reporting.libraries.formula.LibFormulaErrorValue; //导入依赖的package包/类
public TypeValuePair evaluate( final FormulaContext context, final ParameterCallback parameters )
  throws EvaluationException {
  final int parameterCount = parameters.getParameterCount();
  if ( parameterCount != 2 ) {
    throw new EvaluationException( LibFormulaErrorValue.ERROR_ARGUMENTS_VALUE );
  }
  final TypeRegistry typeRegistry = context.getTypeRegistry();

  final Type textType1 = parameters.getType( 0 );
  final Object textValue1 = parameters.getValue( 0 );
  final Type textType2 = parameters.getType( 1 );
  final Object textValue2 = parameters.getValue( 1 );

  final String text = typeRegistry.convertToText( textType1, textValue1 );
  final String substring = typeRegistry.convertToText( textType2, textValue2 );

  return text.contains( substring ) ? RETURN_TRUE : RETURN_FALSE;
}
 
开发者ID:pentaho,项目名称:pentaho-metadata,代码行数:19,代码来源:ContainsFunction.java


示例2: evaluate

import org.pentaho.reporting.libraries.formula.LibFormulaErrorValue; //导入依赖的package包/类
public TypeValuePair evaluate( final FormulaContext context, final ParameterCallback parameters )
  throws EvaluationException {
  final int parameterCount = parameters.getParameterCount();
  if ( parameterCount != 2 ) {
    throw new EvaluationException( LibFormulaErrorValue.ERROR_ARGUMENTS_VALUE );
  }
  final TypeRegistry typeRegistry = context.getTypeRegistry();

  final Type textType1 = parameters.getType( 0 );
  final Object textValue1 = parameters.getValue( 0 );
  final Type textType2 = parameters.getType( 1 );
  final Object textValue2 = parameters.getValue( 1 );

  final String text = typeRegistry.convertToText( textType1, textValue1 );
  final String substring = typeRegistry.convertToText( textType2, textValue2 );

  return text.startsWith( substring ) ? RETURN_TRUE : RETURN_FALSE;
}
 
开发者ID:pentaho,项目名称:pentaho-metadata,代码行数:19,代码来源:BeginsWithFunction.java


示例3: evaluate

import org.pentaho.reporting.libraries.formula.LibFormulaErrorValue; //导入依赖的package包/类
public TypeValuePair evaluate( final FormulaContext context, final ParameterCallback parameters )
  throws EvaluationException {
  final int length = parameters.getParameterCount();
  if ( length != 2 ) {
    throw EvaluationException.getInstance( LibFormulaErrorValue.ERROR_ARGUMENTS_VALUE );
  }

  final TypeRegistry typeRegistry = context.getTypeRegistry();
  final Object value1Raw = parameters.getValue( 0 );
  final Object value2Raw = parameters.getValue( 1 );
  if ( value1Raw == null || value2Raw == null ) {
    throw EvaluationException.getInstance( LibFormulaErrorValue.ERROR_NA_VALUE );
  }

  final Type type1 = parameters.getType( 0 );
  final Type type2 = parameters.getType( 1 );
  final ExtendedComparator comparator = typeRegistry.getComparator( type1, type2 );
  final boolean result = comparator.isEqual( type1, value1Raw, type2, value2Raw );
  if ( result ) {
    return RETURN_TRUE;
  } else {
    return RETURN_FALSE;
  }

}
 
开发者ID:pentaho,项目名称:pentaho-metadata,代码行数:26,代码来源:EqualsFunction.java


示例4: evaluate

import org.pentaho.reporting.libraries.formula.LibFormulaErrorValue; //导入依赖的package包/类
public TypeValuePair evaluate( final FormulaContext context, final ParameterCallback parameters )
  throws EvaluationException {
  final int parameterCount = parameters.getParameterCount();
  if ( parameterCount != 2 ) {
    throw new EvaluationException( LibFormulaErrorValue.ERROR_ARGUMENTS_VALUE );
  }
  final TypeRegistry typeRegistry = context.getTypeRegistry();

  final Type textType1 = parameters.getType( 0 );
  final Object textValue1 = parameters.getValue( 0 );
  final Type textType2 = parameters.getType( 1 );
  final Object textValue2 = parameters.getValue( 1 );

  final String text = typeRegistry.convertToText( textType1, textValue1 );

  String regex = typeRegistry.convertToText( textType2, textValue2 );

  // replace any * or % with .*
  regex = regex.replaceAll( "\\*", ".*" ).replaceAll( "%", ".*" );

  Pattern p = Pattern.compile( regex );
  Matcher m = p.matcher( text );

  return m.find() ? RETURN_TRUE : RETURN_FALSE;
}
 
开发者ID:pentaho,项目名称:pentaho-metadata,代码行数:26,代码来源:LikeFunction.java


示例5: evaluate

import org.pentaho.reporting.libraries.formula.LibFormulaErrorValue; //导入依赖的package包/类
public TypeValuePair evaluate( final FormulaContext context, final ParameterCallback parameters )
  throws EvaluationException {
  final int length = parameters.getParameterCount();
  if ( length < 2 ) {
    throw EvaluationException.getInstance( LibFormulaErrorValue.ERROR_ARGUMENTS_VALUE );
  }

  final TypeRegistry typeRegistry = context.getTypeRegistry();
  final Object value1Raw = parameters.getValue( 0 );
  final Type type1 = parameters.getType( 0 );
  for ( int i = 1; i < parameters.getParameterCount(); i++ ) {
    final Object value2Raw = parameters.getValue( i );
    if ( value1Raw == null || value2Raw == null ) {
      throw EvaluationException.getInstance( LibFormulaErrorValue.ERROR_NA_VALUE );
    }

    final Type type2 = parameters.getType( i );
    final ExtendedComparator comparator = typeRegistry.getComparator( type1, type2 );
    final boolean result = comparator.isEqual( type1, value1Raw, type2, value2Raw );
    if ( result ) {
      return RETURN_TRUE;
    }
  }
  return RETURN_FALSE;
}
 
开发者ID:pentaho,项目名称:pentaho-metadata,代码行数:26,代码来源:InFunction.java


示例6: evaluate

import org.pentaho.reporting.libraries.formula.LibFormulaErrorValue; //导入依赖的package包/类
public TypeValuePair evaluate( final FormulaContext context, final ParameterCallback parameters )
  throws EvaluationException {
  final int parameterCount = parameters.getParameterCount();
  if ( parameterCount != 2 ) {
    throw new EvaluationException( LibFormulaErrorValue.ERROR_ARGUMENTS_VALUE );
  }
  final TypeRegistry typeRegistry = context.getTypeRegistry();

  final Type textType1 = parameters.getType( 0 );
  final Object textValue1 = parameters.getValue( 0 );
  final Type textType2 = parameters.getType( 1 );
  final Object textValue2 = parameters.getValue( 1 );

  final String text = typeRegistry.convertToText( textType1, textValue1 );
  final String substring = typeRegistry.convertToText( textType2, textValue2 );

  return text.endsWith( substring ) ? RETURN_TRUE : RETURN_FALSE;
}
 
开发者ID:pentaho,项目名称:pentaho-metadata,代码行数:19,代码来源:EndsWithFunction.java


示例7: resolveReference

import org.pentaho.reporting.libraries.formula.LibFormulaErrorValue; //导入依赖的package包/类
/**
 * We return the content of a Value with the given name. We cache the position of the field indexes.
 *
 * @see org.jfree.formula.FormulaContext#resolveReference(java.lang.Object)
 */
public Object resolveReference( Object name ) throws EvaluationException {
  if ( name instanceof String ) {
    ValueMetaInterface valueMeta;
    Integer idx = valueIndexMap.get( name );
    if ( idx != null ) {
      valueMeta = rowMeta.getValueMeta( idx.intValue() );
    } else {
      int index = rowMeta.indexOfValue( (String) name );
      if ( index < 0 ) {
        ErrorValue errorValue = new LibFormulaErrorValue( LibFormulaErrorValue.ERROR_INVALID_ARGUMENT );
        throw new EvaluationException( errorValue );
      }
      valueMeta = rowMeta.getValueMeta( index );
      idx = new Integer( index );
      valueIndexMap.put( (String) name, idx );
    }
    Object valueData = rowData[idx];
    try {
      return getPrimitive( valueMeta, valueData );
    } catch ( KettleValueException e ) {
      throw new EvaluationException( LibFormulaErrorValue.ERROR_ARITHMETIC_VALUE );
    }
  }
  return null;
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:31,代码来源:RowForumulaContext.java


示例8: resolveReference

import org.pentaho.reporting.libraries.formula.LibFormulaErrorValue; //导入依赖的package包/类
/**
  * We return the content of a Value with the given name.  We cache the position of the field indexes. 
  * 
  * @see org.jfree.formula.FormulaContext#resolveReference(java.lang.Object)
  */
 public Object resolveReference(Object name) throws ContextEvaluationException
 {
     if(name instanceof String)
     {
         ValueMetaInterface valueMeta;
         Integer idx = (Integer) valueIndexMap.get(name);
         if (idx!=null)
         {
             valueMeta = rowMeta.getValueMeta(idx.intValue());
         }
         else
         {
             int index = rowMeta.indexOfValue((String) name);
             if (index<0)
             {
             	ErrorValue errorValue = new LibFormulaErrorValue(LibFormulaErrorValue.ERROR_INVALID_ARGUMENT);
 				throw new ContextEvaluationException(errorValue);
             }
             valueMeta = rowMeta.getValueMeta(index);
             idx = new Integer(index);
             valueIndexMap.put((String)name, idx);
         }
         Object valueData = rowData[idx];
         try {
	return getPrimitive(valueMeta, valueData);
} catch (KettleValueException e) {
	throw new ContextEvaluationException(LibFormulaErrorValue.ERROR_ARITHMETIC_VALUE);
}
     }
     return null;
 }
 
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:37,代码来源:RowForumulaContext.java


示例9: resolveReference

import org.pentaho.reporting.libraries.formula.LibFormulaErrorValue; //导入依赖的package包/类
/**
  * We return the content of a Value with the given name.  We cache the position of the field indexes. 
  * 
  * @see org.jfree.formula.FormulaContext#resolveReference(java.lang.Object)
  */
 public Object resolveReference(Object name) throws EvaluationException
 {
     if(name instanceof String)
     {
         ValueMetaInterface valueMeta;
         Integer idx = (Integer) valueIndexMap.get(name);
         if (idx!=null)
         {
             valueMeta = rowMeta.getValueMeta(idx.intValue());
         }
         else
         {
             int index = rowMeta.indexOfValue((String) name);
             if (index<0)
             {
             	ErrorValue errorValue = new LibFormulaErrorValue(LibFormulaErrorValue.ERROR_INVALID_ARGUMENT);
 				throw new EvaluationException(errorValue);
             }
             valueMeta = rowMeta.getValueMeta(index);
             idx = new Integer(index);
             valueIndexMap.put((String)name, idx);
         }
         Object valueData = rowData[idx];
         try {
	return getPrimitive(valueMeta, valueData);
} catch (KettleValueException e) {
	throw new EvaluationException(LibFormulaErrorValue.ERROR_ARITHMETIC_VALUE);
}
     }
     return null;
 }
 
开发者ID:jjeb,项目名称:kettle-trunk,代码行数:37,代码来源:RowForumulaContext.java



注:本文中的org.pentaho.reporting.libraries.formula.LibFormulaErrorValue类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java PolicySourceModel类代码示例发布时间:2022-05-23
下一篇:
Java HDF5Factory类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap