use of org.wso2.siddhi.query.api.expression.Variable in project siddhi by wso2.
the class SiddhiQLBaseVisitorImpl method visitSet_clause.
/**
* {@inheritDoc}
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*
* @param ctx
*/
@Override
public UpdateSet visitSet_clause(@NotNull SiddhiQLParser.Set_clauseContext ctx) {
UpdateSet updateSet = new UpdateSet();
for (SiddhiQLParser.Set_assignmentContext setAssignmentContext : ctx.set_assignment()) {
updateSet.set(((Variable) visit(setAssignmentContext.attribute_reference())), (Expression) visit(setAssignmentContext.expression()));
}
populateQueryContext(updateSet, ctx);
return updateSet;
}
use of org.wso2.siddhi.query.api.expression.Variable in project ballerina by ballerina-lang.
the class Generator method createDocForNode.
/**
* Create documentation for enums.
* @param enumNode ballerina enum node.
* @return documentation for enum.
*/
public static EnumDoc createDocForNode(EnumNode enumNode) {
String enumName = enumNode.getName().getValue();
List<Variable> enumerators = new ArrayList<>();
// Iterate through the enumerators
if (enumNode.getEnumerators().size() > 0) {
for (EnumNode.Enumerator enumerator : enumNode.getEnumerators()) {
String desc = fieldAnnotation((BLangNode) enumNode, (BLangNode) enumerator);
Variable variable = new Variable(enumerator.getName().getValue(), "", desc);
enumerators.add(variable);
}
}
return new EnumDoc(enumName, description((BLangNode) enumNode), new ArrayList<>(), enumerators);
}
use of org.wso2.siddhi.query.api.expression.Variable in project ballerina by ballerina-lang.
the class Generator method createDocForNode.
/**
* Create documentation for connectors.
* @param connectorNode ballerina connector node.
* @return documentation for connectors.
*/
public static ConnectorDoc createDocForNode(BLangConnector connectorNode) {
String connectorName = connectorNode.getName().value;
List<Variable> parameters = new ArrayList<>();
List<Documentable> actions = new ArrayList<>();
// Iterate through the connector parameters
if (connectorNode.getParameters().size() > 0) {
for (BLangVariable param : connectorNode.getParameters()) {
String dataType = type(param);
String desc = paramAnnotation(connectorNode, param);
Variable variable = new Variable(param.getName().value, dataType, desc);
parameters.add(variable);
}
}
// Iterate through the actions of the connectors
if (connectorNode.getActions().size() > 0) {
for (BLangAction action : connectorNode.getActions()) {
actions.add(createDocForNode(action));
}
}
return new ConnectorDoc(connectorName, description(connectorNode), actions, parameters);
}
use of org.wso2.siddhi.query.api.expression.Variable in project ballerina by ballerina-lang.
the class Generator method createDocForNode.
/**
* Create documentation for functions.
* @param functionNode ballerina function node.
* @return documentation for functions.
*/
public static FunctionDoc createDocForNode(BLangFunction functionNode) {
String functionName = functionNode.getName().value;
List<Variable> parameters = new ArrayList<>();
List<Variable> returnParams = new ArrayList<>();
// Iterate through the parameters
if (functionNode.getParameters().size() > 0) {
for (BLangVariable param : functionNode.getParameters()) {
String dataType = type(param);
String desc = paramAnnotation(functionNode, param);
Variable variable = new Variable(param.getName().value, dataType, desc);
parameters.add(variable);
}
}
// Iterate through the return types
if (functionNode.getReturnParameters().size() > 0) {
for (int i = 0; i < functionNode.getReturnParameters().size(); i++) {
BLangVariable returnParam = functionNode.getReturnParameters().get(i);
String dataType = type(returnParam);
String desc = returnParamAnnotation(functionNode, i);
Variable variable = new Variable(returnParam.getName().value, dataType, desc);
returnParams.add(variable);
}
}
return new FunctionDoc(functionName, description(functionNode), new ArrayList<>(), parameters, returnParams);
}
use of org.wso2.siddhi.query.api.expression.Variable in project ballerina by ballerina-lang.
the class PackageActionFunctionAndTypesFilter method populateIterableOperations.
private void populateIterableOperations(SymbolInfo variable, List<SymbolInfo> symbolInfoList) {
BType bType = variable.getScopeEntry().symbol.getType();
if (bType instanceof BArrayType || bType instanceof BMapType || bType instanceof BJSONType || bType instanceof BXMLType || bType instanceof BTableType || bType instanceof BIntermediateCollectionType) {
fillForeachIterableOperation(bType, symbolInfoList);
fillMapIterableOperation(bType, symbolInfoList);
fillFilterIterableOperation(bType, symbolInfoList);
fillCountIterableOperation(symbolInfoList);
if (bType instanceof BArrayType && (((BArrayType) bType).eType.toString().equals("int") || ((BArrayType) bType).eType.toString().equals("float"))) {
fillMinIterableOperation(symbolInfoList);
fillMaxIterableOperation(symbolInfoList);
fillAverageIterableOperation(symbolInfoList);
fillSumIterableOperation(symbolInfoList);
}
// TODO: Add support for Table and Tuple collection
}
}
Aggregations