本文整理汇总了Java中com.espertech.esper.util.SimpleNumberCoercer类的典型用法代码示例。如果您正苦于以下问题:Java SimpleNumberCoercer类的具体用法?Java SimpleNumberCoercer怎么用?Java SimpleNumberCoercer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SimpleNumberCoercer类属于com.espertech.esper.util包,在下文中一共展示了SimpleNumberCoercer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getCoercer
import com.espertech.esper.util.SimpleNumberCoercer; //导入依赖的package包/类
private static SimpleNumberCoercer getCoercer(Class typeOne, Class typeTwo) throws ExprValidationException {
// Get the common type such as Bool, String or Double and Long
Class coercionType;
boolean mustCoerce;
try {
coercionType = JavaClassHelper.getCompareToCoercionType(typeOne, typeTwo);
} catch (CoercionException ex) {
throw new ExprValidationException("Implicit conversion from datatype '" +
typeTwo.getSimpleName() +
"' to '" +
typeOne.getSimpleName() +
"' is not allowed");
}
// Check if we need to coerce
mustCoerce = false;
if ((coercionType != JavaClassHelper.getBoxedType(typeOne)) ||
(coercionType != JavaClassHelper.getBoxedType(typeTwo))) {
if (JavaClassHelper.isNumeric(coercionType)) {
mustCoerce = true;
}
}
return !mustCoerce ? null : SimpleNumberCoercerFactory.getCoercer(null, coercionType);
}
示例2: FilterSpecParamEventPropIndexed
import com.espertech.esper.util.SimpleNumberCoercer; //导入依赖的package包/类
/**
* Constructor.
*
* @param lookupable is the lookupable
* @param filterOperator is the type of compare
* @param resultEventAsName is the name of the result event from which to get a property value to compare
* @param resultEventProperty is the name of the property to get from the named result event
* @param isMustCoerce indicates on whether numeric coercion must be performed
* @param coercionType indicates the numeric coercion type to use
* @param numberCoercer interface to use to perform coercion
* @param resultEventIndex index
* @param statementName statement name
* @throws IllegalArgumentException if an operator was supplied that does not take a single constant value
*/
public FilterSpecParamEventPropIndexed(ExprFilterSpecLookupable lookupable, FilterOperator filterOperator, String resultEventAsName,
int resultEventIndex, String resultEventProperty, boolean isMustCoerce,
SimpleNumberCoercer numberCoercer, Class coercionType, String statementName)
throws IllegalArgumentException {
super(lookupable, filterOperator);
this.resultEventAsName = resultEventAsName;
this.resultEventIndex = resultEventIndex;
this.resultEventProperty = resultEventProperty;
this.isMustCoerce = isMustCoerce;
this.numberCoercer = numberCoercer;
this.coercionType = coercionType;
this.statementName = statementName;
if (filterOperator.isRangeOperator()) {
throw new IllegalArgumentException("Illegal filter operator " + filterOperator + " supplied to " +
"event property filter parameter");
}
}
示例3: FilterSpecParamEventProp
import com.espertech.esper.util.SimpleNumberCoercer; //导入依赖的package包/类
/**
* Constructor.
*
* @param lookupable is the property or function to get a lookup value
* @param filterOperator is the type of compare
* @param resultEventAsName is the name of the result event from which to get a property value to compare
* @param resultEventProperty is the name of the property to get from the named result event
* @param isMustCoerce indicates on whether numeric coercion must be performed
* @param coercionType indicates the numeric coercion type to use
* @param numberCoercer interface to use to perform coercion
* @param statementName statement name
* @throws IllegalArgumentException if an operator was supplied that does not take a single constant value
*/
public FilterSpecParamEventProp(ExprFilterSpecLookupable lookupable, FilterOperator filterOperator, String resultEventAsName,
String resultEventProperty, boolean isMustCoerce,
SimpleNumberCoercer numberCoercer, Class coercionType,
String statementName)
throws IllegalArgumentException {
super(lookupable, filterOperator);
this.resultEventAsName = resultEventAsName;
this.resultEventProperty = resultEventProperty;
this.isMustCoerce = isMustCoerce;
this.numberCoercer = numberCoercer;
this.coercionType = coercionType;
this.statementName = statementName;
if (filterOperator.isRangeOperator()) {
throw new IllegalArgumentException("Illegal filter operator " + filterOperator + " supplied to " +
"event property filter parameter");
}
}
示例4: handleProperty
import com.espertech.esper.util.SimpleNumberCoercer; //导入依赖的package包/类
private static FilterSpecParam handleProperty(FilterOperator op, ExprIdentNode identNodeLeft, ExprIdentNode identNodeRight, LinkedHashMap<String, Pair<EventType, String>> arrayEventTypes, String statementName)
throws ExprValidationException {
String propertyName = identNodeLeft.getResolvedPropertyName();
Class leftType = identNodeLeft.getForge().getEvaluationType();
Class rightType = identNodeRight.getForge().getEvaluationType();
SimpleNumberCoercer numberCoercer = getNumberCoercer(leftType, rightType, propertyName);
boolean isMustCoerce = numberCoercer != null;
Class numericCoercionType = JavaClassHelper.getBoxedType(leftType);
String streamName = identNodeRight.getResolvedStreamName();
if (arrayEventTypes != null && !arrayEventTypes.isEmpty() && arrayEventTypes.containsKey(streamName)) {
Pair<Integer, String> indexAndProp = getStreamIndex(identNodeRight.getResolvedPropertyName());
return new FilterSpecParamEventPropIndexed(identNodeLeft.getFilterLookupable(), op, identNodeRight.getResolvedStreamName(), indexAndProp.getFirst(),
indexAndProp.getSecond(), isMustCoerce, numberCoercer, numericCoercionType, statementName);
}
return new FilterSpecParamEventProp(identNodeLeft.getFilterLookupable(), op, identNodeRight.getResolvedStreamName(), identNodeRight.getResolvedPropertyName(),
isMustCoerce, numberCoercer, numericCoercionType, statementName);
}
示例5: FilterSpecParamEventPropIndexed
import com.espertech.esper.util.SimpleNumberCoercer; //导入依赖的package包/类
/**
* Constructor.
* @param lookupable is the lookupable
* @param filterOperator is the type of compare
* @param resultEventAsName is the name of the result event from which to get a property value to compare
* @param resultEventProperty is the name of the property to get from the named result event
* @param isMustCoerce indicates on whether numeric coercion must be performed
* @param coercionType indicates the numeric coercion type to use
* @param numberCoercer interface to use to perform coercion
* @param resultEventIndex index
* @throws IllegalArgumentException if an operator was supplied that does not take a single constant value
*/
public FilterSpecParamEventPropIndexed(FilterSpecLookupable lookupable, FilterOperator filterOperator, String resultEventAsName,
int resultEventIndex, String resultEventProperty, boolean isMustCoerce,
SimpleNumberCoercer numberCoercer, Class coercionType, String statementName)
throws IllegalArgumentException
{
super(lookupable, filterOperator);
this.resultEventAsName = resultEventAsName;
this.resultEventIndex = resultEventIndex;
this.resultEventProperty = resultEventProperty;
this.isMustCoerce = isMustCoerce;
this.numberCoercer = numberCoercer;
this.coercionType = coercionType;
this.statementName = statementName;
if (filterOperator.isRangeOperator())
{
throw new IllegalArgumentException("Illegal filter operator " + filterOperator + " supplied to " +
"event property filter parameter");
}
}
示例6: FilterSpecParamEventProp
import com.espertech.esper.util.SimpleNumberCoercer; //导入依赖的package包/类
/**
* Constructor.
* @param lookupable is the property or function to get a lookup value
* @param filterOperator is the type of compare
* @param resultEventAsName is the name of the result event from which to get a property value to compare
* @param resultEventProperty is the name of the property to get from the named result event
* @param isMustCoerce indicates on whether numeric coercion must be performed
* @param coercionType indicates the numeric coercion type to use
* @param numberCoercer interface to use to perform coercion
* @throws IllegalArgumentException if an operator was supplied that does not take a single constant value
*/
public FilterSpecParamEventProp(FilterSpecLookupable lookupable, FilterOperator filterOperator, String resultEventAsName,
String resultEventProperty, boolean isMustCoerce,
SimpleNumberCoercer numberCoercer, Class coercionType,
String statementName)
throws IllegalArgumentException
{
super(lookupable, filterOperator);
this.resultEventAsName = resultEventAsName;
this.resultEventProperty = resultEventProperty;
this.isMustCoerce = isMustCoerce;
this.numberCoercer = numberCoercer;
this.coercionType = coercionType;
this.statementName = statementName;
if (filterOperator.isRangeOperator())
{
throw new IllegalArgumentException("Illegal filter operator " + filterOperator + " supplied to " +
"event property filter parameter");
}
}
示例7: handleProperty
import com.espertech.esper.util.SimpleNumberCoercer; //导入依赖的package包/类
private static FilterSpecParam handleProperty(FilterOperator op, ExprIdentNode identNodeLeft, ExprIdentNode identNodeRight, LinkedHashMap<String, Pair<EventType, String>> arrayEventTypes, String statementName)
throws ExprValidationException
{
String propertyName = identNodeLeft.getResolvedPropertyName();
Class leftType = identNodeLeft.getExprEvaluator().getType();
Class rightType = identNodeRight.getExprEvaluator().getType();
SimpleNumberCoercer numberCoercer = getNumberCoercer(leftType, rightType, propertyName);
boolean isMustCoerce = numberCoercer != null;
Class numericCoercionType = JavaClassHelper.getBoxedType(leftType);
String streamName = identNodeRight.getResolvedStreamName();
if (arrayEventTypes != null && !arrayEventTypes.isEmpty() && arrayEventTypes.containsKey(streamName))
{
Pair<Integer, String> indexAndProp = getStreamIndex(identNodeRight.getResolvedPropertyName());
return new FilterSpecParamEventPropIndexed(identNodeLeft.getFilterLookupable(), op, identNodeRight.getResolvedStreamName(), indexAndProp.getFirst(),
indexAndProp.getSecond(), isMustCoerce, numberCoercer, numericCoercionType, statementName);
}
return new FilterSpecParamEventProp(identNodeLeft.getFilterLookupable(), op, identNodeRight.getResolvedStreamName(), identNodeRight.getResolvedPropertyName(),
isMustCoerce, numberCoercer, numericCoercionType, statementName);
}
示例8: applyEnterCodegen
import com.espertech.esper.util.SimpleNumberCoercer; //导入依赖的package包/类
public void applyEnterCodegen(int column, CodegenMethodNode method, ExprForgeCodegenSymbol symbols, ExprForge[] forges, CodegenClassScope classScope) {
if (inputValueType == BigInteger.class) {
AggregatorSumBigInteger.applyEnterCodegen(parent.isDistinct(), parent.isHasFilter(), column, method, symbols, forges, classScope);
} else if (inputValueType == BigDecimal.class) {
AggregatorSumBigDecimal.applyEnterCodegen(parent.isDistinct(), parent.isHasFilter(), column, method, symbols, forges, classScope);
} else {
SimpleNumberCoercer coercer = getCoercerNonBigIntDec(inputValueType);
AggregatorCodegenUtil.sumAndCountApplyEnterCodegen(parent.isDistinct(), parent.isHasFilter(), column, method, symbols, forges, classScope, coercer);
}
}
示例9: applyLeaveCodegen
import com.espertech.esper.util.SimpleNumberCoercer; //导入依赖的package包/类
public void applyLeaveCodegen(int column, CodegenMethodNode method, ExprForgeCodegenSymbol symbols, ExprForge[] forges, CodegenClassScope classScope) {
if (inputValueType == BigInteger.class) {
AggregatorSumBigInteger.applyLeaveCodegen(parent.isDistinct(), parent.isHasFilter(), column, method, symbols, forges, classScope);
} else if (inputValueType == BigDecimal.class) {
AggregatorSumBigDecimal.applyLeaveCodegen(parent.isDistinct(), parent.isHasFilter(), column, method, symbols, forges, classScope);
} else {
SimpleNumberCoercer coercer = getCoercerNonBigIntDec(inputValueType);
AggregatorCodegenUtil.sumAndCountApplyLeaveCodegen(parent.isDistinct(), parent.isHasFilter(), column, method, symbols, forges, classScope, coercer);
}
}
示例10: getCoercerNonBigIntDec
import com.espertech.esper.util.SimpleNumberCoercer; //导入依赖的package包/类
private SimpleNumberCoercer getCoercerNonBigIntDec(Class inputValueType) {
SimpleNumberCoercer coercer;
if (inputValueType == Long.class || inputValueType == long.class) {
coercer = SimpleNumberCoercerFactory.SimpleNumberCoercerLong.INSTANCE;
} else if (inputValueType == Integer.class || inputValueType == int.class) {
coercer = SimpleNumberCoercerFactory.SimpleNumberCoercerInt.INSTANCE;
} else if (inputValueType == Double.class || inputValueType == double.class) {
coercer = SimpleNumberCoercerFactory.SimpleNumberCoercerDouble.INSTANCE;
} else if (inputValueType == Float.class || inputValueType == float.class) {
coercer = SimpleNumberCoercerFactory.SimpleNumberCoercerFloat.INSTANCE;
} else {
coercer = SimpleNumberCoercerFactory.SimpleNumberCoercerInt.INSTANCE;
}
return coercer;
}
示例11: sumAndCountApplyEnterCodegen
import com.espertech.esper.util.SimpleNumberCoercer; //导入依赖的package包/类
public static void sumAndCountApplyEnterCodegen(boolean distinct, boolean hasFilter, int column, CodegenMethodNode method, ExprForgeCodegenSymbol symbols, ExprForge[] forges, CodegenClassScope classScope, SimpleNumberCoercer coercer) {
CodegenExpressionTypePair value = AggregatorCodegenUtil.prefixWithFilterNullDistinctChecks(true, distinct, hasFilter, forges, column, method, symbols, classScope);
CodegenExpressionRef sumRef = sumRefCol(column);
CodegenExpressionRef cntRef = cntRefCol(column);
method.getBlock().increment(cntRef)
.assignRef(sumRef, op(sumRef, "+", coercer.coerceCodegen(value.getExpression(), value.getType())));
}
示例12: sumAndCountApplyLeaveCodegen
import com.espertech.esper.util.SimpleNumberCoercer; //导入依赖的package包/类
public static void sumAndCountApplyLeaveCodegen(boolean distinct, boolean hasFilter, int column, CodegenMethodNode method, ExprForgeCodegenSymbol symbols, ExprForge[] forges, CodegenClassScope classScope, SimpleNumberCoercer coercer) {
CodegenExpressionTypePair value = AggregatorCodegenUtil.prefixWithFilterNullDistinctChecks(false, distinct, hasFilter, forges, column, method, symbols, classScope);
CodegenExpressionRef sumRef = sumRefCol(column);
CodegenExpressionRef cntRef = cntRefCol(column);
Consumer<CodegenBlock> clearCode = block -> {
block.assignRef(sumRef, constant(0)).assignRef(cntRef, constant(0));
};
method.getBlock().ifCondition(relational(cntRef, LE, constant(1))).apply(clearCode)
.ifElse()
.decrement(cntRef)
.assignRef(sumRefCol(column), op(sumRefCol(column), "-", coercer.coerceCodegen(value.getExpression(), value.getType())));
}
示例13: PropertyIndexedEventTableCoerceAddFactory
import com.espertech.esper.util.SimpleNumberCoercer; //导入依赖的package包/类
/**
* Ctor.
*
* @param streamNum is the stream number of the indexed stream
* @param eventType is the event type of the indexed stream
* @param propertyNames are the property names to get property values
* @param coercionType are the classes to coerce indexed values to
*/
public PropertyIndexedEventTableCoerceAddFactory(int streamNum, EventType eventType, String[] propertyNames, Class[] coercionType) {
super(streamNum, eventType, propertyNames, false, null);
this.coercionType = coercionType;
coercers = new SimpleNumberCoercer[coercionType.length];
for (int i = 0; i < coercionType.length; i++) {
if (JavaClassHelper.isNumeric(coercionType[i])) {
coercers[i] = SimpleNumberCoercerFactory.getCoercer(null, coercionType[i]);
}
}
}
示例14: ExprArrayNodeForge
import com.espertech.esper.util.SimpleNumberCoercer; //导入依赖的package包/类
public ExprArrayNodeForge(ExprArrayNode parent, Class arrayReturnType, boolean mustCoerce, SimpleNumberCoercer coercer, Object constantResult) {
this.parent = parent;
this.arrayReturnType = arrayReturnType;
this.mustCoerce = mustCoerce;
this.coercer = coercer;
this.constantResult = constantResult;
}
示例15: ExprInNodeForge
import com.espertech.esper.util.SimpleNumberCoercer; //导入依赖的package包/类
public ExprInNodeForge(ExprInNodeImpl parent, boolean mustCoerce, SimpleNumberCoercer coercer, Class coercionType, boolean hasCollectionOrArray) {
this.parent = parent;
this.mustCoerce = mustCoerce;
this.coercer = coercer;
this.coercionType = coercionType;
this.hasCollectionOrArray = hasCollectionOrArray;
}