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


Java OCommandContext.setVariable方法代码示例

本文整理汇总了Java中com.orientechnologies.orient.core.command.OCommandContext.setVariable方法的典型用法代码示例。如果您正苦于以下问题:Java OCommandContext.setVariable方法的具体用法?Java OCommandContext.setVariable怎么用?Java OCommandContext.setVariable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.orientechnologies.orient.core.command.OCommandContext的用法示例。


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

示例1: sendLookupTime

import com.orientechnologies.orient.core.command.OCommandContext; //导入方法依赖的package包/类
public void sendLookupTime(OCommandContext context, final TopDocs docs, final Integer limit, long startFetching) {
  if (context != null) {

    final long finalTime = System.currentTimeMillis() - startFetching;
    context.setVariable((indexName + ".lookupTime").replace(".", "_"), new HashMap<String, Object>() {
      {
        put("limit", limit);
        put("totalTime", finalTime);
        put("totalHits", docs.totalHits);
        put("returnedHits", docs.scoreDocs.length);
        put("maxScore", docs.getMaxScore());

      }
    });
  }
}
 
开发者ID:orientechnologies,项目名称:orientdb-lucene,代码行数:17,代码来源:OLuceneIndexManagerAbstract.java

示例2: executeIndexQuery

import com.orientechnologies.orient.core.command.OCommandContext; //导入方法依赖的package包/类
@Override
public OIndexCursor executeIndexQuery(OCommandContext iContext, OIndex<?> index, List<Object> keyParams, boolean ascSortOrder) {
  OIndexDefinition definition = index.getDefinition();
  int idxSize = definition.getFields().size();
  int paramsSize = keyParams.size();
  OIndexCursor cursor;
  Object indexResult = index.get(new OSpatialCompositeKey(keyParams).setOperation(SpatialOperation.IsWithin));
  if (indexResult == null || indexResult instanceof OIdentifiable)
    cursor = new OIndexCursorSingleValue((OIdentifiable) indexResult, new OSpatialCompositeKey(keyParams));
  else
    cursor = new OIndexCursorCollectionValue(((Collection<OIdentifiable>) indexResult).iterator(), new OSpatialCompositeKey(
        keyParams));

  iContext.setVariable("$luceneIndex", true);
  return cursor;
}
 
开发者ID:orientechnologies,项目名称:orientdb-lucene,代码行数:17,代码来源:OLuceneWithinOperator.java

示例3: evaluateRecord

import com.orientechnologies.orient.core.command.OCommandContext; //导入方法依赖的package包/类
@Override
public Object evaluateRecord(OIdentifiable iRecord, ODocument iCurrentResult, OSQLFilterCondition iCondition, Object iLeft,
    Object iRight, OCommandContext iContext) {

  List<Number> left = (List<Number>) iLeft;

  double lat = left.get(0).doubleValue();
  double lon = left.get(1).doubleValue();

  Shape shape = factory.context().makePoint(lon, lat);
  List<Number> right = (List<Number>) iRight;

  double lat1 = right.get(0).doubleValue();
  double lon1 = right.get(1).doubleValue();
  Shape shape1 = factory.context().makePoint(lon1, lat1);

  Map map = (Map) right.get(2);
  double distance = 0;

  Number n = (Number) map.get("maxDistance");
  if (n != null) {
    distance = n.doubleValue();
  }
  Point p = (Point) shape1;
  Circle circle = factory.context().makeCircle(p.getX(), p.getY(),
      DistanceUtils.dist2Degrees(distance, DistanceUtils.EARTH_MEAN_RADIUS_KM));
  double docDistDEG = factory.context().getDistCalc().distance((Point) shape, p);
  final double docDistInKM = DistanceUtils.degrees2Dist(docDistDEG, DistanceUtils.EARTH_EQUATORIAL_RADIUS_KM);
  iContext.setVariable("distance", docDistInKM);
  return shape.relate(circle) == SpatialRelation.WITHIN;
}
 
开发者ID:orientechnologies,项目名称:orientdb-spatial,代码行数:32,代码来源:OLuceneNearOperator.java

示例4: executeIndexQuery

import com.orientechnologies.orient.core.command.OCommandContext; //导入方法依赖的package包/类
@Override
public OIndexCursor executeIndexQuery(OCommandContext iContext, OIndex<?> index, List<Object> keyParams, boolean ascSortOrder) {

  OIndexCursor cursor;
  OIndexDefinition definition = index.getDefinition();
  int idxSize = definition.getFields().size();
  int paramsSize = keyParams.size();

  double distance = 0;
  Object spatial = iContext.getVariable("spatial");
  if (spatial != null) {
    if (spatial instanceof Number) {
      distance = ((Double) OType.convert(spatial, Double.class)).doubleValue();
    } else if (spatial instanceof Map) {
      Map<String, Object> params = (Map<String, Object>) spatial;

      Object dst = params.get("maxDistance");
      if (dst != null && dst instanceof Number) {
        distance = ((Double) OType.convert(dst, Double.class)).doubleValue();
      }
    }
  }
  Object indexResult = index.get(new OSpatialCompositeKey(keyParams).setMaxDistance(distance).setContext(iContext));
  if (indexResult == null || indexResult instanceof OIdentifiable)
    cursor = new OIndexCursorSingleValue((OIdentifiable) indexResult, new OSpatialCompositeKey(keyParams));
  else
    cursor = new OIndexCursorCollectionValue(((Collection<OIdentifiable>) indexResult), new OSpatialCompositeKey(
        keyParams));

  iContext.setVariable("$luceneIndex", true);
  return cursor;
}
 
开发者ID:orientechnologies,项目名称:orientdb-spatial,代码行数:33,代码来源:OLuceneNearOperator.java

示例5: executeIndexQuery

import com.orientechnologies.orient.core.command.OCommandContext; //导入方法依赖的package包/类
@Override
public OIndexCursor executeIndexQuery(OCommandContext iContext, OIndex<?> index, List<Object> keyParams, boolean ascSortOrder) {
  OIndexDefinition definition = index.getDefinition();
  int idxSize = definition.getFields().size();
  int paramsSize = keyParams.size();
  OIndexCursor cursor;
  Object indexResult = index.get(new OSpatialCompositeKey(keyParams).setOperation(SpatialOperation.IsWithin));
  if (indexResult == null || indexResult instanceof OIdentifiable)
    cursor = new OIndexCursorSingleValue((OIdentifiable) indexResult, new OSpatialCompositeKey(keyParams));
  else
    cursor = new OIndexCursorCollectionValue(((Collection<OIdentifiable>) indexResult), new OSpatialCompositeKey(keyParams));

  iContext.setVariable("$luceneIndex", true);
  return cursor;
}
 
开发者ID:orientechnologies,项目名称:orientdb-spatial,代码行数:16,代码来源:OLuceneWithinOperator.java

示例6: amendCommand

import com.orientechnologies.orient.core.command.OCommandContext; //导入方法依赖的package包/类
@Override
public void amendCommand(final OCommandRequest query, final CommandMethodDescriptor descriptor,
                         final Object instance, final Object... arguments) {
    @SuppressWarnings("unchecked")
    final Map<String, Integer> vars = (Map<String, Integer>) descriptor.extDescriptors.get(KEY);
    final OCommandContext context = query.getContext();
    for (Map.Entry<String, Integer> entry : vars.entrySet()) {
        context.setVariable(entry.getKey(), arguments[entry.getValue()]);
    }
}
 
开发者ID:xvik,项目名称:guice-persist-orient,代码行数:11,代码来源:VarParamExtension.java

示例7: sendTotalHits

import com.orientechnologies.orient.core.command.OCommandContext; //导入方法依赖的package包/类
public void sendTotalHits(OCommandContext context, TopDocs docs) {
  if (context != null) {

    if (context.getVariable("totalHits") == null) {
      context.setVariable("totalHits", docs.totalHits);
    } else {
      context.setVariable("totalHits", null);
    }
    context.setVariable((indexName + ".totalHits").replace(".", "_"), docs.totalHits);
  }
}
 
开发者ID:orientechnologies,项目名称:orientdb-lucene,代码行数:12,代码来源:OLuceneIndexManagerAbstract.java

示例8: executeIndexQuery

import com.orientechnologies.orient.core.command.OCommandContext; //导入方法依赖的package包/类
@Override
public OIndexCursor executeIndexQuery(OCommandContext iContext, OIndex<?> index, List<Object> keyParams, boolean ascSortOrder) {
  OIndexCursor cursor;
  Object indexResult = index.get(new OFullTextCompositeKey(keyParams).setContext(iContext));
  if (indexResult == null || indexResult instanceof OIdentifiable)
    cursor = new OIndexCursorSingleValue((OIdentifiable) indexResult, new OFullTextCompositeKey(keyParams));
  else
    cursor = new OIndexCursorCollectionValue(((Collection<OIdentifiable>) indexResult).iterator(), new OFullTextCompositeKey(
        keyParams));
  iContext.setVariable("$luceneIndex", true);
  return cursor;
}
 
开发者ID:orientechnologies,项目名称:orientdb-lucene,代码行数:13,代码来源:OLuceneTextOperator.java

示例9: evaluateRecord

import com.orientechnologies.orient.core.command.OCommandContext; //导入方法依赖的package包/类
@Override
public Object evaluateRecord(OIdentifiable iRecord, ODocument iCurrentResult, OSQLFilterCondition iCondition, Object iLeft,
    Object iRight, OCommandContext iContext) {

  List<Number> left = (List<Number>) iLeft;

  double lat = left.get(0).doubleValue();
  double lon = left.get(1).doubleValue();

  Shape shape = SpatialContext.GEO.makePoint(lon, lat);
  List<Number> right = (List<Number>) iRight;

  double lat1 =  right.get(0).doubleValue();
  double lon1 =  right.get(1).doubleValue();
  Shape shape1 = SpatialContext.GEO.makePoint(lon1, lat1);

  Map map = (Map) right.get(2);
  double distance = 0;

  Number n = (Number) map.get("maxDistance");
  if (n != null) {
    distance = n.doubleValue();
  }
  Point p = (Point) shape1;
  Circle circle = SpatialContext.GEO.makeCircle(p.getX(), p.getY(),
      DistanceUtils.dist2Degrees(distance, DistanceUtils.EARTH_MEAN_RADIUS_KM));
  double docDistDEG = SpatialContext.GEO.getDistCalc().distance((Point) shape, p);
  final double docDistInKM = DistanceUtils.degrees2Dist(docDistDEG, DistanceUtils.EARTH_EQUATORIAL_RADIUS_KM);
  iContext.setVariable("distance", docDistInKM);
  return shape.relate(circle) == SpatialRelation.WITHIN;
}
 
开发者ID:orientechnologies,项目名称:orientdb-lucene,代码行数:32,代码来源:OLuceneNearOperator.java

示例10: executeIndexQuery

import com.orientechnologies.orient.core.command.OCommandContext; //导入方法依赖的package包/类
@Override
public OIndexCursor executeIndexQuery(OCommandContext iContext, OIndex<?> index, List<Object> keyParams, boolean ascSortOrder) {

  OIndexCursor cursor;
  OIndexDefinition definition = index.getDefinition();
  int idxSize = definition.getFields().size();
  int paramsSize = keyParams.size();

  double distance = 0;
  Object spatial = iContext.getVariable("spatial");
  if (spatial != null) {
    if (spatial instanceof Number) {
      distance = ((Double) OType.convert(spatial, Double.class)).doubleValue();
    } else if (spatial instanceof Map) {
      Map<String, Object> params = (Map<String, Object>) spatial;

      Object dst = params.get("maxDistance");
      if (dst != null && dst instanceof Number) {
        distance = ((Double) OType.convert(dst, Double.class)).doubleValue();
      }
    }
  }
  Object indexResult = index.get(new OSpatialCompositeKey(keyParams).setMaxDistance(distance).setContext(iContext));
  if (indexResult == null || indexResult instanceof OIdentifiable)
    cursor = new OIndexCursorSingleValue((OIdentifiable) indexResult, new OSpatialCompositeKey(keyParams));
  else
    cursor = new OIndexCursorCollectionValue(((Collection<OIdentifiable>) indexResult).iterator(), new OSpatialCompositeKey(
        keyParams));

  iContext.setVariable("$luceneIndex", true);
  return cursor;
}
 
开发者ID:orientechnologies,项目名称:orientdb-lucene,代码行数:33,代码来源:OLuceneNearOperator.java

示例11: onJoinNotFound

import com.orientechnologies.orient.core.command.OCommandContext; //导入方法依赖的package包/类
@Override
public void onJoinNotFound(final ODatabaseDocumentTx db, final OCommandContext iContext, final OIndex<?> iIndex, final Object iKey) {
  iContext.setVariable("joinNotFound", ((Integer) iContext.getVariable("joinNotFound", 0)) + 1);
  OLogManager.instance().warn(this, "     + %d line: join record not found in index '%s' for key='%s'",
      iContext.getVariable("currentLine"), iIndex, iKey);
}
 
开发者ID:orientechnologies,项目名称:orientdb-etl,代码行数:7,代码来源:ODefaultImporterListener.java

示例12: createDefaultContext

import com.orientechnologies.orient.core.command.OCommandContext; //导入方法依赖的package包/类
protected static OCommandContext createDefaultContext() {
  final OCommandContext context = new OBasicCommandContext();
  context.setVariable("dumpEveryMs", 1000);
  return context;
}
 
开发者ID:orientechnologies,项目名称:orientdb-etl,代码行数:6,代码来源:OETLProcessor.java


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