public void toString(Map<Object, Object> params, StringBuilder builder) { if (legacy || (expression == null && cluster != null && position != null)) { builder.append("#" + cluster.getValue() + ":" + position.getValue()); } else { builder.append("{\"@rid\":"); expression.toString(params, builder); builder.append("}"); } }
@Override protected void fetchNextResults(OCommandContext ctx, int nRecords) { if (!this.entryPoints.isEmpty()) { OTraverseResult item = (OTraverseResult) this.entryPoints.remove(0); this.results.add(item); for (OTraverseProjectionItem proj : projections) { Object nextStep = proj.execute(item, ctx); if (this.maxDepth == null || this.maxDepth.getValue().intValue() > item.depth) { addNextEntryPoints(nextStep, item.depth + 1, (List<OIdentifiable>) item.getMetadata("$path"), ctx); } } } }
/** * checks if this RID is from one of these clusters * * @param rid * @param filterClusters * @param database * * @return */ private boolean isFromClusters(ORid rid, Set<String> filterClusters, ODatabase database) { if (filterClusters == null) { throw new IllegalArgumentException(); } String clusterName = database.getClusterNameById(rid.getCluster().getValue().intValue()); return filterClusters.contains(clusterName); }
public Integer evaluate(OCommandContext ctx) { if (this.num != null) { return num.getValue().intValue(); } else if (inputParam != null) { Object obj = inputParam.getValue(ctx.getInputParameters()); if (obj == null || !(obj instanceof Number)) { throw new OCommandExecutionException("" + obj + " is not a number (BATCH)"); } return ((Number) obj).intValue(); } return -1; }
return apply(expression, (OResult) input, ctx, recursion == null ? 0 : recursion.getValue().intValue()); return apply(expression, (OIdentifiable) input, ctx, recursion == null ? 0 : recursion.getValue().intValue()); return apply(expression, (Map) input, ctx, recursion == null ? 0 : recursion.getValue().intValue());
@Override protected void fetchNextResults(OCommandContext ctx, int nRecords) { if (!this.entryPoints.isEmpty()) { OTraverseResult item = (OTraverseResult) this.entryPoints.remove(0); this.results.add(item); for (OTraverseProjectionItem proj : projections) { Object nextStep = proj.execute(item, ctx); Integer depth = item.depth != null ? item.depth : (Integer) item.getMetadata("$depth"); if (this.maxDepth == null || this.maxDepth.getValue().intValue() > depth) { addNextEntryPoints(nextStep, depth + 1, (List) item.getMetadata("$path"), (List) item.getMetadata("$stack"), ctx); } } } }
public int getValue(OCommandContext ctx) { if (num != null) { return num.getValue().intValue(); } if (inputParam != null) { Object paramValue = inputParam.getValue(ctx.getInputParameters()); if (paramValue instanceof Number) { return ((Number) paramValue).intValue(); } else { throw new OCommandExecutionException("Invalid value for LIMIT: " + paramValue); } } throw new OCommandExecutionException("No value for LIMIT"); }
public int getValue(OCommandContext ctx) { if (num != null) { return num.getValue().intValue(); } if (inputParam != null) { Object paramValue = inputParam.getValue(ctx.getInputParameters()); if (paramValue instanceof Number) { return ((Number) paramValue).intValue(); } else { throw new OCommandExecutionException("Invalid value for SKIP: " + paramValue); } } throw new OCommandExecutionException("No value for SKIP"); }
@Override public OResultSet executeSimple(OCommandContext ctx) { OInternalResultSet result = new OInternalResultSet(); OResultInternal item = new OResultInternal(); item.setProperty("operation", "sleep"); try { Thread.sleep(millis.getValue().intValue()); item.setProperty("result", "OK"); item.setProperty("millis", millis.getValue().intValue()); } catch (InterruptedException e) { item.setProperty("result", "failure"); item.setProperty("errorType", e.getClass().getSimpleName()); item.setProperty("errorMessage", e.getMessage()); } result.add(item); return result; }
private long calculateMinClusterPosition() { if (queryPlanning == null || queryPlanning.ridRangeConditions == null || queryPlanning.ridRangeConditions.isEmpty()) { return -1; } long maxValue = -1; for (OBooleanExpression ridRangeCondition : queryPlanning.ridRangeConditions.getSubBlocks()) { if (ridRangeCondition instanceof OBinaryCondition) { OBinaryCondition cond = (OBinaryCondition) ridRangeCondition; ORid condRid = cond.getRight().getRid(); OBinaryCompareOperator operator = cond.getOperator(); if (condRid != null) { if (condRid.getCluster().getValue().intValue() != this.clusterId) { continue; } if (operator instanceof OGtOperator || operator instanceof OGeOperator) { maxValue = Math.max(maxValue, condRid.getPosition().getValue().longValue()); } } } } return maxValue; }
/** * @param request * @param ctx * @param record * * @return false if limit was reached */ private boolean addSingleResult(OSQLAsynchQuery<ODocument> request, OBasicCommandContext ctx, ORecord record) { if (((OBasicCommandContext) context).addToUniqueResult(record)) { request.getResultListener().result(record); long currentCount = ctx.getResultsProcessed().incrementAndGet(); long limitValue = limitFromProtocol; if (limit != null) { limitValue = limit.num.getValue().longValue(); } if (limitValue > -1 && limitValue <= currentCount) { return false; } } return true; }
public void setValue(OResult currentRecord, Object target, Object value, OCommandContext ctx) { Object idx = null; if (this.rid != null) { idx = this.rid.toRecordId(currentRecord, ctx); } else if (inputParam != null) { idx = inputParam.getValue(ctx.getInputParameters()); } else if (expression != null) { idx = expression.execute(currentRecord, ctx); } else if (integer != null) { idx = integer.getValue(); } if (target instanceof Set && idx instanceof Number) { setValue((Set) target, ((Number) idx).intValue(), value, ctx); } else if (target instanceof List && idx instanceof Number) { setValue((List) target, ((Number) idx).intValue(), value, ctx); } else if (target instanceof Map) { setValue((Map) target, idx, value, ctx); } else if (target != null && target.getClass().isArray() && idx instanceof Number) { setArrayValue(target, ((Number) idx).intValue(), value, ctx); } }
result.setProperty("abstract", abstractClass); } else if (totalClusterNo != null) { clazz = schema.createClass(name.getStringValue(), totalClusterNo.getValue().intValue(), superclasses); } else if (clusters != null) { clusters.stream().map(x -> x.getValue().intValue()).collect(Collectors.toList()); int[] clusterIds = new int[clusters.size()]; for (int i = 0; i < clusters.size(); i++) { clusterIds[i] = clusters.get(i).getValue().intValue();
jjtc000 = false; jjtn000.jjtSetLastToken(getToken(0)); {if (true) return val.getValue();} } catch (Throwable jjte000) { if (jjtc000) {
jjtc000 = false; jjtn000.jjtSetLastToken(getToken(0)); {if (true) return val.getValue();} } catch (Throwable jjte000) { if (jjtc000) {
clusterId = clusterNumber.getValue().intValue(); } else { clusterId = database.getClusterIdByName(clusterName.getStringValue());
jj_consume_token(TIMEOUT); val = Integer(); jjtn000.val = val.getValue(); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case RETURN: