当前位置: 首页>>代码示例>>Java>>正文


Java Attribute.Type方法代码示例

本文整理汇总了Java中org.wso2.siddhi.query.api.definition.Attribute.Type方法的典型用法代码示例。如果您正苦于以下问题:Java Attribute.Type方法的具体用法?Java Attribute.Type怎么用?Java Attribute.Type使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.wso2.siddhi.query.api.definition.Attribute的用法示例。


在下文中一共展示了Attribute.Type方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createMaxAggregator

import org.wso2.siddhi.query.api.definition.Attribute; //导入方法依赖的package包/类
public static OutputAttributeAggregator createMaxAggregator(Attribute.Type[] types) {
    if (types.length > 1) {
        throw new QueryCreationException("Max can only have one parameter");
    }
    Attribute.Type type = types[0];
    switch (type) {
        case STRING:
            throw new OperationNotSupportedException("Max not supported for string");
        case INT:
            return new MaxOutputAttributeAggregatorInt();
        case LONG:
            return new MaxOutputAttributeAggregatorLong();
        case FLOAT:
            return new MaxOutputAttributeAggregatorFloat();
        case DOUBLE:
            return new MaxOutputAttributeAggregatorDouble();
        case BOOL:
            throw new OperationNotSupportedException("Max not supported for bool");
    }
    throw new OperationNotSupportedException("Max not supported for " + type);
}
 
开发者ID:redBorder,项目名称:rb-bi,代码行数:22,代码来源:OutputAttributeHandlerParser.java

示例2: createSumAggregator

import org.wso2.siddhi.query.api.definition.Attribute; //导入方法依赖的package包/类
public static OutputAttributeAggregator createSumAggregator(Attribute.Type[] types) {
    if (types.length > 1) {
        throw new QueryCreationException("Sum can only have one parameter");
    }
    Attribute.Type type = types[0];
    switch (type) {
        case STRING:
            throw new OperationNotSupportedException("Sum not supported for string");
        case INT:
            return new SumOutputAttributeAggregatorInt();
        case LONG:
            return new SumOutputAttributeAggregatorLong();
        case FLOAT:
            return new SumOutputAttributeAggregatorFloat();
        case DOUBLE:
            return new SumOutputAttributeAggregatorDouble();
        case BOOL:
            throw new OperationNotSupportedException("Sum not supported for bool");
    }
    throw new OperationNotSupportedException("Sum not supported for " + type);
}
 
开发者ID:redBorder,项目名称:rb-bi,代码行数:22,代码来源:OutputAttributeHandlerParser.java

示例3: extractAndValidateFeatures

import org.wso2.siddhi.query.api.definition.Attribute; //导入方法依赖的package包/类
/**
 * @param inputDefinition
 * @param attributeExpressionExecutors
 * @param startIndex                   starting index
 * @param noOfFeatures
 * @return
 */
public static List<VariableExpressionExecutor> extractAndValidateFeatures(
        AbstractDefinition inputDefinition, ExpressionExecutor[]
        attributeExpressionExecutors,
        int startIndex, int noOfFeatures) {

    List<VariableExpressionExecutor> featureVariableExpressionExecutors = new ArrayList<>();

    // feature values start
    for (int i = startIndex; i < (startIndex + noOfFeatures); i++) {
        if (attributeExpressionExecutors[i] instanceof VariableExpressionExecutor) {
            featureVariableExpressionExecutors.add((VariableExpressionExecutor)
                    attributeExpressionExecutors[i]);
            // other attributes should be numeric type.
            String attributeName = ((VariableExpressionExecutor)
                    attributeExpressionExecutors[i]).getAttribute().getName();
            Attribute.Type featureAttributeType = inputDefinition.
                    getAttributeType(attributeName);

            //feature attributes not numerical type
            if (!isNumeric(featureAttributeType)) {
                throw new SiddhiAppValidationException("model.features in " + (i + 1) + "th parameter is not "
                        + "a numerical type attribute. Found " + attributeExpressionExecutors[i].getReturnType()
                        + ". Check the input stream definition.");
            }
        } else {
            throw new SiddhiAppValidationException((i + 1) + "th parameter is not " +
                    "an attribute (VariableExpressionExecutor) present in the stream definition. Found a "
                    + attributeExpressionExecutors[i].getClass().getCanonicalName());
        }
    }
    return featureVariableExpressionExecutors;
}
 
开发者ID:wso2-extensions,项目名称:siddhi-gpl-execution-streamingml,代码行数:40,代码来源:CoreUtils.java

示例4: convertToEventArrayForDefaultMapping

import org.wso2.siddhi.query.api.definition.Attribute; //导入方法依赖的package包/类
private Event[] convertToEventArrayForDefaultMapping(Object eventObject) {
    Gson gson = new Gson();
    JsonObject[] eventObjects = gson.fromJson(eventObject.toString(), JsonObject[].class);
    Event[] events = new Event[eventObjects.length];
    int index = 0;
    JsonObject eventObj = null;
    for (JsonObject jsonEvent : eventObjects) {
        if (jsonEvent.has(DEFAULT_JSON_EVENT_IDENTIFIER)) {
            eventObj = jsonEvent.get(DEFAULT_JSON_EVENT_IDENTIFIER).getAsJsonObject();
            if (failOnMissingAttribute && eventObj.size() < streamAttributes.size()) {
                log.error("Json message " + eventObj.toString() + " contains missing attributes. " +
                        "Hence dropping the message.");
                continue;
            }
        } else {
            log.error("Default json message " + eventObj.toString()
                    + " in the array does not have the valid event identifier \"event\". " +
                    "Hence dropping the message.");
            continue;
        }
        Event event = new Event(streamAttributes.size());
        Object[] data = event.getData();


        int position = 0;
        for (Attribute attribute : streamAttributes) {
            String attributeName = attribute.getName();
            Attribute.Type type = attribute.getType();
            String attributeValue = eventObj.get(attributeName).getAsString();
            if (attributeValue == null) {
                data[position++] = null;
            } else {
                data[position++] = attributeConverter.getPropertyValue(
                        attributeValue, type);
            }
        }
        events[index++] = event;
    }
    return Arrays.copyOfRange(events, 0, index);
}
 
开发者ID:wso2-extensions,项目名称:siddhi-map-json,代码行数:41,代码来源:JsonSourceMapper.java

示例5: registerType

import org.wso2.siddhi.query.api.definition.Attribute; //导入方法依赖的package包/类
public static void registerType(Class<?> javaType, Attribute.Type siddhiType) {
    if (JAVA_TO_SIDDHI_TYPE.containsKey(javaType)) {
        throw new IllegalArgumentException("Java type: " + javaType + " or siddhi type: " + siddhiType + " were already registered");
    }
    JAVA_TO_SIDDHI_TYPE.put(javaType, siddhiType);
    SIDDHI_TO_JAVA_TYPE.put(siddhiType, javaType);
}
 
开发者ID:apache,项目名称:bahir-flink,代码行数:8,代码来源:SiddhiTypeFactory.java

示例6: registerType

import org.wso2.siddhi.query.api.definition.Attribute; //导入方法依赖的package包/类
public static void registerType(Class<?> javaType, Attribute.Type siddhiType) {
	if (JAVA_TO_SIDDHI_TYPE.containsKey(javaType)) {
		throw new IllegalArgumentException("Java type: " + javaType + " or siddhi type: " + siddhiType + " were already registered");
	}
	JAVA_TO_SIDDHI_TYPE.put(javaType, siddhiType);
	SIDDHI_TO_JAVA_TYPE.put(siddhiType, javaType);
}
 
开发者ID:haoch,项目名称:flink-siddhi,代码行数:8,代码来源:SiddhiTypeFactory.java

示例7: setAttributeExpressionExecutors

import org.wso2.siddhi.query.api.definition.Attribute; //导入方法依赖的package包/类
public void setAttributeExpressionExecutors(List<ExpressionExecutor> attributeExpressionExecutors) {
    this.attributeExpressionExecutors = attributeExpressionExecutors;
    attributeSize = attributeExpressionExecutors.size();
    attributeTypes = new Attribute.Type[attributeExpressionExecutors.size()];
    for (int i = 0; i < attributeExpressionExecutors.size(); i++) {
        attributeTypes[i] = attributeExpressionExecutors.get(i).getReturnType();
    }
}
 
开发者ID:redBorder,项目名称:rb-bi,代码行数:9,代码来源:FunctionExecutor.java

示例8: isNumeric

import org.wso2.siddhi.query.api.definition.Attribute; //导入方法依赖的package包/类
public static boolean isNumeric(Attribute.Type attributeType) {
    return numericTypes.contains(attributeType);
}
 
开发者ID:wso2-extensions,项目名称:siddhi-gpl-execution-streamingml,代码行数:4,代码来源:CoreUtils.java

示例9: isLabelType

import org.wso2.siddhi.query.api.definition.Attribute; //导入方法依赖的package包/类
public static boolean isLabelType(Attribute.Type attributeType) {
    return labelTypes.contains(attributeType);
}
 
开发者ID:wso2-extensions,项目名称:siddhi-gpl-execution-streamingml,代码行数:4,代码来源:CoreUtils.java

示例10: getJavaType

import org.wso2.siddhi.query.api.definition.Attribute; //导入方法依赖的package包/类
public static Class<?> getJavaType(Attribute.Type attributeType) {
	if (!SIDDHI_TO_JAVA_TYPE.containsKey(attributeType)) {
		throw new IllegalArgumentException("Unable to get java type for siddhi attribute type: " + attributeType);
	}
	return SIDDHI_TO_JAVA_TYPE.get(attributeType);
}
 
开发者ID:haoch,项目名称:flink-siddhi,代码行数:7,代码来源:SiddhiTypeFactory.java

示例11: getType

import org.wso2.siddhi.query.api.definition.Attribute; //导入方法依赖的package包/类
public Attribute.Type getType() {
    return type;
}
 
开发者ID:redBorder,项目名称:rb-bi,代码行数:4,代码来源:Type.java

示例12: createAttributeAggregator

import org.wso2.siddhi.query.api.definition.Attribute; //导入方法依赖的package包/类
@Override
public OutputAttributeAggregator createAttributeAggregator(Attribute.Type[] types) {
    return OutputAttributeHandlerParser.createMinAggregator(types);
}
 
开发者ID:redBorder,项目名称:rb-bi,代码行数:5,代码来源:MinOutputAttributeAggregatorFactory.java

示例13: createAttributeAggregator

import org.wso2.siddhi.query.api.definition.Attribute; //导入方法依赖的package包/类
@Override
public OutputAttributeAggregator createAttributeAggregator(Attribute.Type[] types) {
    return OutputAttributeHandlerParser.createMaxAggregator(types);
}
 
开发者ID:redBorder,项目名称:rb-bi,代码行数:5,代码来源:MaxOutputAttributeAggregatorFactory.java

示例14: getReturnType

import org.wso2.siddhi.query.api.definition.Attribute; //导入方法依赖的package包/类
public Attribute.Type getReturnType() {
    return Attribute.Type.LONG;
}
 
开发者ID:redBorder,项目名称:rb-bi,代码行数:4,代码来源:MinusExpressionExecutorLong.java

示例15: getReturnType

import org.wso2.siddhi.query.api.definition.Attribute; //导入方法依赖的package包/类
public Attribute.Type getReturnType() {
    return type;
}
 
开发者ID:redBorder,项目名称:rb-bi,代码行数:4,代码来源:ConstantExpressionExecutor.java


注:本文中的org.wso2.siddhi.query.api.definition.Attribute.Type方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。