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


Java ImmutableTriple.of方法代码示例

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


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

示例1: connObjectInit

import org.apache.commons.lang3.tuple.ImmutableTriple; //导入方法依赖的package包/类
private Triple<ExternalResource, AnyType, Provision> connObjectInit(
        final String resourceKey, final String anyTypeKey) {

    ExternalResource resource = resourceDAO.authFind(resourceKey);
    if (resource == null) {
        throw new NotFoundException("Resource '" + resourceKey + "'");
    }
    AnyType anyType = anyTypeDAO.find(anyTypeKey);
    if (anyType == null) {
        throw new NotFoundException("AnyType '" + anyTypeKey + "'");
    }
    Optional<? extends Provision> provision = resource.getProvision(anyType);
    if (!provision.isPresent()) {
        throw new NotFoundException("Provision on resource '" + resourceKey + "' for type '" + anyTypeKey + "'");
    }

    return ImmutableTriple.of(resource, anyType, provision.get());
}
 
开发者ID:apache,项目名称:syncope,代码行数:19,代码来源:ResourceLogic.java

示例2: splitFilters

import org.apache.commons.lang3.tuple.ImmutableTriple; //导入方法依赖的package包/类
/**
 * Given a list of conditions that contain Druid valid operations and
 * a list that contains those that contain any non-supported operation,
 * it outputs a triple with three different categories:
 * 1-l) condition filters on the timestamp column,
 * 2-m) condition filters that can be pushed to Druid,
 * 3-r) condition filters that cannot be pushed to Druid.
 */
private static Triple<List<RexNode>, List<RexNode>, List<RexNode>> splitFilters(
    final RexBuilder rexBuilder, final DruidQuery input, final List<RexNode> validPreds,
    final List<RexNode> nonValidPreds, final int timestampFieldIdx) {
  final List<RexNode> timeRangeNodes = new ArrayList<>();
  final List<RexNode> pushableNodes = new ArrayList<>();
  final List<RexNode> nonPushableNodes = new ArrayList<>(nonValidPreds);
  // Number of columns with the dimensions and timestamp
  for (RexNode conj : validPreds) {
    final RelOptUtil.InputReferencedVisitor visitor = new RelOptUtil.InputReferencedVisitor();
    conj.accept(visitor);
    if (visitor.inputPosReferenced.contains(timestampFieldIdx)) {
      if (visitor.inputPosReferenced.size() != 1) {
        // Complex predicate, transformation currently not supported
        nonPushableNodes.add(conj);
      } else {
        timeRangeNodes.add(conj);
      }
    } else {
      pushableNodes.add(conj);
    }
  }
  return ImmutableTriple.of(timeRangeNodes, pushableNodes, nonPushableNodes);
}
 
开发者ID:apache,项目名称:calcite,代码行数:32,代码来源:DruidRules.java

示例3: extractScheme

import org.apache.commons.lang3.tuple.ImmutableTriple; //导入方法依赖的package包/类
/**
 * Split the path of a filename into the extensionless path (for URI construction) and the URI scheme (based on the file extension)
 * 
 * @param path
 *            The relative path within the contents directory
 * @return a triple of the path (left), the attribute(middle), and the URI scheme (right)
 */
public static Triple<String, String, Scheme> extractScheme(String path) {
    int chop = path.lastIndexOf('.');
    if (chop < 0) return null;
    String schemeName = path.substring(chop);

    String attr = null;
    Scheme scheme = ext2scheme.get(schemeName);
    if (scheme == null) {
        scheme = raw2scheme.get(schemeName);
        if (scheme == null) {
            scheme = BLOB; // Oooerr - unmatched extensions will be blobs (THIS IS GOOD, BELIEVE ME)
        } else {
            path = path.substring(0, chop);
        }
        switch (scheme) {
        case BLOB:
            attr = getResolver().getMimeTypeFromPath(path);
            break;
        case SCRIPT:
            attr = schemeName.equals(".jjs") ? "jjs" : "raw";
            break;
        default:
            throw new Error("Severe: Unhandled scheme in raw2scheme map"); // can only happen if a bad checkin is made
        }
    } else {
        path = path.substring(0, chop);
    }
    return ImmutableTriple.of(path, attr, scheme);
}
 
开发者ID:RapturePlatform,项目名称:Rapture,代码行数:37,代码来源:PluginSandboxItem.java

示例4: composeEmailForUser

import org.apache.commons.lang3.tuple.ImmutableTriple; //导入方法依赖的package包/类
private ImmutableTriple<String, String, String> composeEmailForUser(EventsContext context)
    throws MustacheException, IOException {

    List<Map<String, Object>> cardsModel = new ArrayList<>();

    StringBuilder subject = new StringBuilder();
    for (Entry<Integer, List<Event>> kv : context.events.entrySet()) {

        Map<String, Object> cardModel = new HashMap<>();

        CardFull cf = context.cards.get(kv.getKey());
        StringBuilder cardName = new StringBuilder(cf.getBoardShortName()).append("-").append(cf.getSequence())
            .append(" ").append(cf.getName());

        cardModel.put("cardFull", cf);
        cardModel.put("cardName", cardName.toString());
        cardModel.put("cardEvents", composeCardSection(kv.getValue(), context));

        subject.append(cf.getBoardShortName()).append("-").append(cf.getSequence()).append(", ");

        cardsModel.add(cardModel);
    }

    Map<String, Object> tmplModel = new HashMap<>();
    String baseApplicationUrl = StringUtils
        .appendIfMissing(configurationRepository.getValue(Key.BASE_APPLICATION_URL), "/");
    tmplModel.put("cards", cardsModel);
    tmplModel.put("baseApplicationUrl", baseApplicationUrl);
    tmplModel.put("htmlEscape", new Mustache.Lambda() {
        @Override
        public void execute(Fragment frag, Writer out) throws IOException {
            out.write(Escapers.HTML.escape(frag.execute()));
        }
    });

    String text = emailTextTemplate.execute(tmplModel);
    String html = emailHtmlTemplate.execute(tmplModel);

    return ImmutableTriple.of(subject.substring(0, subject.length() - ", ".length()), text, html);
}
 
开发者ID:digitalfondue,项目名称:lavagna,代码行数:41,代码来源:NotificationService.java

示例5: splitPredicates

import org.apache.commons.lang3.tuple.ImmutableTriple; //导入方法依赖的package包/类
/**
 * Classifies each of the predicates in the list into one of these three
 * categories:
 *
 * <ul>
 * <li> 1-l) column equality predicates, or
 * <li> 2-m) range predicates, comprising &lt;, &le;, &gt;, &ge;, and =
 *      between a reference and a constant, or
 * <li> 3-r) residual predicates, all the rest
 * </ul>
 *
 * <p>For each category, it creates the conjunction of the predicates. The
 * result is an array of three RexNode objects corresponding to each
 * category.
 */
private static Triple<RexNode, RexNode, RexNode> splitPredicates(
    RexBuilder rexBuilder, RexNode pred) {
  List<RexNode> equiColumnsPreds = new ArrayList<>();
  List<RexNode> rangePreds = new ArrayList<>();
  List<RexNode> residualPreds = new ArrayList<>();
  for (RexNode e : RelOptUtil.conjunctions(pred)) {
    switch (e.getKind()) {
    case EQUALS:
      RexCall eqCall = (RexCall) e;
      if (RexUtil.isReferenceOrAccess(eqCall.getOperands().get(0), false)
              && RexUtil.isReferenceOrAccess(eqCall.getOperands().get(1), false)) {
        equiColumnsPreds.add(e);
      } else if ((RexUtil.isReferenceOrAccess(eqCall.getOperands().get(0), false)
              && RexUtil.isConstant(eqCall.getOperands().get(1)))
          || (RexUtil.isReferenceOrAccess(eqCall.getOperands().get(1), false)
              && RexUtil.isConstant(eqCall.getOperands().get(0)))) {
        rangePreds.add(e);
      } else {
        residualPreds.add(e);
      }
      break;
    case LESS_THAN:
    case GREATER_THAN:
    case LESS_THAN_OR_EQUAL:
    case GREATER_THAN_OR_EQUAL:
    case NOT_EQUALS:
      RexCall rangeCall = (RexCall) e;
      if ((RexUtil.isReferenceOrAccess(rangeCall.getOperands().get(0), false)
              && RexUtil.isConstant(rangeCall.getOperands().get(1)))
          || (RexUtil.isReferenceOrAccess(rangeCall.getOperands().get(1), false)
              && RexUtil.isConstant(rangeCall.getOperands().get(0)))) {
        rangePreds.add(e);
      } else {
        residualPreds.add(e);
      }
      break;
    default:
      residualPreds.add(e);
    }
  }
  return ImmutableTriple.<RexNode, RexNode, RexNode>of(
      RexUtil.composeConjunction(rexBuilder, equiColumnsPreds, false),
      RexUtil.composeConjunction(rexBuilder, rangePreds, false),
      RexUtil.composeConjunction(rexBuilder, residualPreds, false));
}
 
开发者ID:apache,项目名称:calcite,代码行数:61,代码来源:AbstractMaterializedViewRule.java

示例6: computeCompensationPredicates

import org.apache.commons.lang3.tuple.ImmutableTriple; //导入方法依赖的package包/类
/**
 * We check whether the predicates in the source are contained in the predicates
 * in the target. The method treats separately the equi-column predicates, the
 * range predicates, and the rest of predicates.
 *
 * <p>If the containment is confirmed, we produce compensation predicates that
 * need to be added to the target to produce the results in the source. Thus,
 * if source and target expressions are equivalent, those predicates will be the
 * true constant.
 *
 * <p>In turn, if containment cannot be confirmed, the method returns null.
 */
private static Triple<RexNode, RexNode, RexNode> computeCompensationPredicates(
    RexBuilder rexBuilder,
    RexSimplify simplify,
    EquivalenceClasses sourceEC,
    Triple<RexNode, RexNode, RexNode> sourcePreds,
    EquivalenceClasses targetEC,
    Triple<RexNode, RexNode, RexNode> targetPreds,
    BiMap<RelTableRef, RelTableRef> sourceToTargetTableMapping) {
  final RexNode compensationColumnsEquiPred;
  final RexNode compensationRangePred;
  final RexNode compensationResidualPred;

  // 1. Establish relationship between source and target equivalence classes.
  // If every target equivalence class is not a subset of a source
  // equivalence class, we bail out.
  compensationColumnsEquiPred = generateEquivalenceClasses(
      rexBuilder, sourceEC, targetEC);
  if (compensationColumnsEquiPred == null) {
    // Cannot rewrite
    return null;
  }

  // 2. We check that range intervals for the source are contained in the target.
  // Compute compensating predicates.
  final RexNode queryRangePred = RexUtil.swapColumnReferences(
      rexBuilder, sourcePreds.getMiddle(), sourceEC.getEquivalenceClassesMap());
  final RexNode viewRangePred = RexUtil.swapTableColumnReferences(
      rexBuilder, targetPreds.getMiddle(), sourceToTargetTableMapping.inverse(),
      sourceEC.getEquivalenceClassesMap());
  compensationRangePred = SubstitutionVisitor.splitFilter(
      simplify, queryRangePred, viewRangePred);
  if (compensationRangePred == null) {
    // Cannot rewrite
    return null;
  }

  // 3. Finally, we check that residual predicates of the source are satisfied
  // within the target.
  // Compute compensating predicates.
  final RexNode queryResidualPred = RexUtil.swapColumnReferences(
      rexBuilder, sourcePreds.getRight(), sourceEC.getEquivalenceClassesMap());
  final RexNode viewResidualPred = RexUtil.swapTableColumnReferences(
      rexBuilder, targetPreds.getRight(), sourceToTargetTableMapping.inverse(),
      sourceEC.getEquivalenceClassesMap());
  compensationResidualPred = SubstitutionVisitor.splitFilter(
      simplify, queryResidualPred, viewResidualPred);
  if (compensationResidualPred == null) {
    // Cannot rewrite
    return null;
  }

  return ImmutableTriple.<RexNode, RexNode, RexNode>of(
      compensationColumnsEquiPred, compensationRangePred, compensationResidualPred);
}
 
开发者ID:apache,项目名称:calcite,代码行数:67,代码来源:AbstractMaterializedViewRule.java

示例7: WorldBlockCoord

import org.apache.commons.lang3.tuple.ImmutableTriple; //导入方法依赖的package包/类
private WorldBlockCoord(int x, int y, int z) { data = ImmutableTriple.of(x, y, z); } 
开发者ID:AtomicBlom,项目名称:SchematicMetaBlocks,代码行数:2,代码来源:SchematicLoader.java


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