• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Mutable类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.commons.lang3.mutable.Mutable的典型用法代码示例。如果您正苦于以下问题:Java Mutable类的具体用法?Java Mutable怎么用?Java Mutable使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Mutable类属于org.apache.commons.lang3.mutable包,在下文中一共展示了Mutable类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: doGetVariable

import org.apache.commons.lang3.mutable.Mutable; //导入依赖的package包/类
/**
 * Result {@code null} means that there is no variable. Result other than {@code null} means that there is a variable (that may possibly
 * be {@code null}).
 *
 * @param name the name of the variable.
 * @return a holder for a variable.
 */
protected Mutable<Object> doGetVariable(String name) {
    List<Object> variables =
            scripts.stream().filter(script -> script.getMetaClass().hasProperty(script.getMetaClass().getTheClass(), name) != null)
                    .map(script -> script.getProperty(name)).collect(Collectors.toList());

    if (variables.isEmpty()) {
        try {
            return new MutableObject<>(binding.getProperty(name));
        } catch (MissingPropertyException e) {
            return null; // This means that no variable has been found!
        }
    }

    return new MutableObject<>(variables.get(0));
}
 
开发者ID:softelnet,项目名称:sponge,代码行数:23,代码来源:GroovyKnowledgeBaseInterpreter.java


示例2: computeLocalProperties

import org.apache.commons.lang3.mutable.Mutable; //导入依赖的package包/类
public void computeLocalProperties(ILogicalOperator op) {
    OrderOperator ord = (OrderOperator) op;
    List<OrderColumn> orderColumns = new ArrayList<OrderColumn>();
    for (Pair<IOrder, Mutable<ILogicalExpression>> p : ord.getOrderExpressions()) {
        ILogicalExpression expr = p.second.getValue();
        if (expr.getExpressionTag() == LogicalExpressionTag.VARIABLE) {
            VariableReferenceExpression varRef = (VariableReferenceExpression) expr;
            LogicalVariable var = varRef.getVariableReference();
            orderColumns.add(new OrderColumn(var, p.first.getKind()));
        } else {
            throw new IllegalStateException();
        }
    }
    sortColumns = orderColumns.toArray(new OrderColumn[orderColumns.size()]);
    orderProp = new LocalOrderProperty(orderColumns);
}
 
开发者ID:apache,项目名称:incubator-asterixdb-hyracks,代码行数:17,代码来源:AbstractStableSortPOperator.java


示例3: printLogicalPlan

import org.apache.commons.lang3.mutable.Mutable; //导入依赖的package包/类
public static void printLogicalPlan(ILogicalPlan plan) throws AlgebricksException {
    int indent = 5;
    StringBuilder out = new StringBuilder();
    int randomInt = 10000 + randomGenerator.nextInt(100);
    appendln(out, "digraph G {");
    for (Mutable<ILogicalOperator> root : plan.getRoots()) {
        printVisualizationGraph((AbstractLogicalOperator) root.getValue(), indent, out, "", randomInt);
    }
    appendln(out, "\n}\n}");
    try {
        File file = File.createTempFile("logicalPlan", ".txt");
        FileUtils.writeStringToFile(file, out.toString());
        file.deleteOnExit();
    } catch (IOException e) {
        e.printStackTrace();
    }
}
 
开发者ID:apache,项目名称:incubator-asterixdb-hyracks,代码行数:18,代码来源:PlanPlotter.java


示例4: rewriteWithRuleCollection

import org.apache.commons.lang3.mutable.Mutable; //导入依赖的package包/类
@Override
public boolean rewriteWithRuleCollection(Mutable<ILogicalOperator> root, Collection<IAlgebraicRewriteRule> rules)
        throws AlgebricksException {
    boolean anyRuleFired = false;
    boolean anyChange = false;
    do {
        anyChange = false;
        for (IAlgebraicRewriteRule r : rules) {
            while (true) {
                boolean ruleFired = rewriteOperatorRef(root, r);
                if (ruleFired) {
                    anyChange = true;
                    anyRuleFired = true;
                } else {
                    break; // go to next rule
                }
            }
        }
    } while (anyChange);
    return anyRuleFired;
}
 
开发者ID:apache,项目名称:incubator-asterixdb-hyracks,代码行数:22,代码来源:PrioritizedRuleController.java


示例5: visitTokenizeOperator

import org.apache.commons.lang3.mutable.Mutable; //导入依赖的package包/类
@Override
public ILogicalOperator visitTokenizeOperator(TokenizeOperator op, Void arg) throws AlgebricksException {
    List<Mutable<ILogicalExpression>> newPrimaryKeyExpressions = new ArrayList<Mutable<ILogicalExpression>>();
    deepCopyExpressionRefs(newPrimaryKeyExpressions, op.getPrimaryKeyExpressions());
    List<Mutable<ILogicalExpression>> newSecondaryKeyExpressions = new ArrayList<Mutable<ILogicalExpression>>();
    deepCopyExpressionRefs(newSecondaryKeyExpressions, op.getSecondaryKeyExpressions());
    List<LogicalVariable> newTokenizeVars = new ArrayList<LogicalVariable>();
    deepCopyVars(newTokenizeVars, op.getTokenizeVars());
    Mutable<ILogicalExpression> newFilterExpression = new MutableObject<ILogicalExpression>(
            ((AbstractLogicalExpression) op.getFilterExpression()).cloneExpression());
    List<Object> newTokenizeVarTypes = new ArrayList<Object>();
    deepCopyObjects(newTokenizeVarTypes, op.getTokenizeVarTypes());

    TokenizeOperator tokenizeOp = new TokenizeOperator(op.getDataSourceIndex(), newPrimaryKeyExpressions,
            newSecondaryKeyExpressions, newTokenizeVars, newFilterExpression, op.getOperation(), op.isBulkload(),
            op.isPartitioned(), newTokenizeVarTypes);
    return tokenizeOp;
}
 
开发者ID:apache,项目名称:incubator-asterixdb-hyracks,代码行数:19,代码来源:OperatorDeepCopyVisitor.java


示例6: substituteVarRec

import org.apache.commons.lang3.mutable.Mutable; //导入依赖的package包/类
public static void substituteVarRec(AbstractLogicalOperator op, LogicalVariable v1, LogicalVariable v2,
        boolean goThroughNts, ITypingContext ctx) throws AlgebricksException {
    VariableUtilities.substituteVariables(op, v1, v2, goThroughNts, ctx);
    for (Mutable<ILogicalOperator> opRef2 : op.getInputs()) {
        substituteVarRec((AbstractLogicalOperator) opRef2.getValue(), v1, v2, goThroughNts, ctx);
    }
    if (op.getOperatorTag() == LogicalOperatorTag.NESTEDTUPLESOURCE && goThroughNts) {
        NestedTupleSourceOperator nts = (NestedTupleSourceOperator) op;
        if (nts.getDataSourceReference() != null) {
            AbstractLogicalOperator op2 = (AbstractLogicalOperator) nts.getDataSourceReference().getValue()
                    .getInputs().get(0).getValue();
            substituteVarRec(op2, v1, v2, goThroughNts, ctx);
        }
    }
    if (op.hasNestedPlans()) {
        AbstractOperatorWithNestedPlans aonp = (AbstractOperatorWithNestedPlans) op;
        for (ILogicalPlan p : aonp.getNestedPlans()) {
            for (Mutable<ILogicalOperator> ref : p.getRoots()) {
                AbstractLogicalOperator aop = (AbstractLogicalOperator) ref.getValue();
                substituteVarRec(aop, v1, v2, goThroughNts, ctx);
            }
        }
    }
}
 
开发者ID:apache,项目名称:incubator-asterixdb-hyracks,代码行数:25,代码来源:OperatorManipulationUtil.java


示例7: rewritePre

import org.apache.commons.lang3.mutable.Mutable; //导入依赖的package包/类
@Override
public boolean rewritePre(Mutable<ILogicalOperator> opRef, IOptimizationContext context)
        throws AlgebricksException {
    AbstractLogicalOperator op = (AbstractLogicalOperator) opRef.getValue();
    if (op.getOperatorTag() != LogicalOperatorTag.PROJECT) {
        return false;
    }
    ProjectOperator pi = (ProjectOperator) op;
    Mutable<ILogicalOperator> opRef2 = pi.getInputs().get(0);

    HashSet<LogicalVariable> toPush = new HashSet<LogicalVariable>();
    toPush.addAll(pi.getVariables());

    Pair<Boolean, Boolean> p = pushThroughOp(toPush, opRef2, op, context);
    boolean smthWasPushed = p.first;
    if (p.second) { // the original projection is redundant
        opRef.setValue(op.getInputs().get(0).getValue());
        smthWasPushed = true;
    }

    return smthWasPushed;
}
 
开发者ID:apache,项目名称:incubator-asterixdb-hyracks,代码行数:23,代码来源:PushProjectDownRule.java


示例8: pushNeededProjections

import org.apache.commons.lang3.mutable.Mutable; //导入依赖的package包/类
private static boolean pushNeededProjections(HashSet<LogicalVariable> toPush, Mutable<ILogicalOperator> opRef,
        IOptimizationContext context, ILogicalOperator initialOp) throws AlgebricksException {
    HashSet<LogicalVariable> allP = new HashSet<LogicalVariable>();
    AbstractLogicalOperator op = (AbstractLogicalOperator) opRef.getValue();
    VariableUtilities.getSubplanLocalLiveVariables(op, allP);

    HashSet<LogicalVariable> toProject = new HashSet<LogicalVariable>();
    for (LogicalVariable v : toPush) {
        if (allP.contains(v)) {
            toProject.add(v);
        }
    }
    if (toProject.equals(allP)) {
        // projection would be redundant, since we would project everything
        // but we can try with the children
        boolean push = false;
        if (pushThroughOp(toProject, opRef, initialOp, context).first) {
            push = true;
        }
        return push;
    } else {
        return pushAllProjectionsOnTopOf(toProject, opRef, context, initialOp);
    }
}
 
开发者ID:apache,项目名称:incubator-asterixdb-hyracks,代码行数:25,代码来源:PushProjectDownRule.java


示例9: rewritePost

import org.apache.commons.lang3.mutable.Mutable; //导入依赖的package包/类
@Override
public boolean rewritePost(Mutable<ILogicalOperator> opRef, IOptimizationContext context)
        throws AlgebricksException {
    AbstractLogicalOperator op = (AbstractLogicalOperator) opRef.getValue();
    if (op.getInputs().size() <= 0)
        return false;
    AbstractLogicalOperator project = (AbstractLogicalOperator) op.getInputs().get(0).getValue();
    if (project.getOperatorTag() != LogicalOperatorTag.PROJECT)
        return false;
    AbstractLogicalOperator exchange = (AbstractLogicalOperator) project.getInputs().get(0).getValue();
    if (exchange.getOperatorTag() != LogicalOperatorTag.EXCHANGE)
        return false;
    AbstractLogicalOperator inputOp = (AbstractLogicalOperator) exchange.getInputs().get(0).getValue();
    if (inputOp.getOperatorTag() != LogicalOperatorTag.DATASOURCESCAN)
        return false;
    DataSourceScanOperator scanOp = (DataSourceScanOperator) inputOp;
    ProjectOperator projectOp = (ProjectOperator) project;
    scanOp.addProjectVariables(projectOp.getVariables());
    if (op.getOperatorTag() != LogicalOperatorTag.EXCHANGE) {
        op.getInputs().set(0, project.getInputs().get(0));
    } else {
        op.getInputs().set(0, exchange.getInputs().get(0));
    }
    return true;
}
 
开发者ID:apache,项目名称:incubator-asterixdb-hyracks,代码行数:26,代码来源:PushProjectIntoDataSourceScanRule.java


示例10: rewriteWithRuleCollection

import org.apache.commons.lang3.mutable.Mutable; //导入依赖的package包/类
@Override
public boolean rewriteWithRuleCollection(Mutable<ILogicalOperator> root,
        Collection<IAlgebraicRewriteRule> ruleCollection) throws AlgebricksException {
    boolean anyRuleFired = false;
    boolean anyChange = false;
    do {
        anyChange = false;
        for (IAlgebraicRewriteRule rule : ruleCollection) {
            boolean ruleFired = rewriteOperatorRef(root, rule, true, fullDfs);
            if (ruleFired) {
                anyChange = true;
                anyRuleFired = true;
            }
        }
    } while (anyChange);
    return anyRuleFired;
}
 
开发者ID:apache,项目名称:incubator-asterixdb-hyracks,代码行数:18,代码来源:SequentialFixpointRuleController.java


示例11: visitIndexInsertDeleteUpsertOperator

import org.apache.commons.lang3.mutable.Mutable; //导入依赖的package包/类
@Override
public ILogicalOperator visitIndexInsertDeleteUpsertOperator(IndexInsertDeleteUpsertOperator op, Void arg)
        throws AlgebricksException {
    List<Mutable<ILogicalExpression>> newPrimaryKeyExpressions = new ArrayList<Mutable<ILogicalExpression>>();
    deepCopyExpressionRefs(newPrimaryKeyExpressions, op.getPrimaryKeyExpressions());
    List<Mutable<ILogicalExpression>> newSecondaryKeyExpressions = new ArrayList<Mutable<ILogicalExpression>>();
    deepCopyExpressionRefs(newSecondaryKeyExpressions, op.getSecondaryKeyExpressions());
    Mutable<ILogicalExpression> newFilterExpression = new MutableObject<ILogicalExpression>(
            ((AbstractLogicalExpression) op.getFilterExpression()).cloneExpression());
    List<Mutable<ILogicalExpression>> newLSMComponentFilterExpressions = new ArrayList<Mutable<ILogicalExpression>>();
    deepCopyExpressionRefs(newLSMComponentFilterExpressions, op.getAdditionalFilteringExpressions());
    IndexInsertDeleteUpsertOperator indexInsertDeleteOp = new IndexInsertDeleteUpsertOperator(
            op.getDataSourceIndex(), newPrimaryKeyExpressions, newSecondaryKeyExpressions, newFilterExpression,
            op.getOperation(), op.isBulkload());
    indexInsertDeleteOp.setAdditionalFilteringExpressions(newLSMComponentFilterExpressions);
    return indexInsertDeleteOp;
}
 
开发者ID:apache,项目名称:incubator-asterixdb-hyracks,代码行数:18,代码来源:OperatorDeepCopyVisitor.java


示例12: mapVariablesInNestedPlans

import org.apache.commons.lang3.mutable.Mutable; //导入依赖的package包/类
private void mapVariablesInNestedPlans(ILogicalOperator opOrigin, ILogicalOperator arg) throws AlgebricksException {
    AbstractOperatorWithNestedPlans op = (AbstractOperatorWithNestedPlans) opOrigin;
    AbstractOperatorWithNestedPlans argOp = (AbstractOperatorWithNestedPlans) arg;
    List<ILogicalPlan> plans = op.getNestedPlans();
    List<ILogicalPlan> plansArg = argOp.getNestedPlans();
    if (plans.size() != plansArg.size())
        return;
    for (int i = 0; i < plans.size(); i++) {
        List<Mutable<ILogicalOperator>> roots = plans.get(i).getRoots();
        List<Mutable<ILogicalOperator>> rootsArg = plansArg.get(i).getRoots();
        if (roots.size() != rootsArg.size())
            return;
        for (int j = 0; j < roots.size(); j++) {
            ILogicalOperator topOp1 = roots.get(j).getValue();
            ILogicalOperator topOp2 = rootsArg.get(j).getValue();
            topOp1.accept(this, topOp2);
        }
    }
}
 
开发者ID:apache,项目名称:incubator-asterixdb-hyracks,代码行数:20,代码来源:IsomorphismVariableMappingVisitor.java


示例13: getVariable

import org.apache.commons.lang3.mutable.Mutable; //导入依赖的package包/类
@Override
public Object getVariable(String name) {
    try {
        Mutable<Object> variable = doGetVariable(name);
        if (variable == null) {
            throw new SpongeException("Variable '" + name + "' not found in any of the scripts");
        }

        return variable.getValue();
    } catch (Throwable e) {
        throw SpongeUtils.wrapException("getVariable", e);
    }
}
 
开发者ID:softelnet,项目名称:sponge,代码行数:14,代码来源:GroovyKnowledgeBaseInterpreter.java


示例14: shouldAddToEventTreeForNMode

import org.apache.commons.lang3.mutable.Mutable; //导入依赖的package包/类
@Override
protected boolean shouldAddToEventTreeForNMode(TreeNode<NodeValue> parentNode, Mutable<TreeNode<NodeValue>> newNodeHolder,
        Event event) {
    handleNoneEventHappenedButShouldNot(parentNode, newNodeHolder.getValue(), event);

    return false;
}
 
开发者ID:softelnet,项目名称:sponge,代码行数:8,代码来源:UnorderedRuleAdapterRuntime.java


示例15: shouldAddToEventTreeForNMode

import org.apache.commons.lang3.mutable.Mutable; //导入依赖的package包/类
@Override
protected boolean shouldAddToEventTreeForNMode(TreeNode<NodeValue> parentNode, Mutable<TreeNode<NodeValue>> newNodeHolder,
        Event event) {
    boolean result = false;

    if (handleNoneEventHappenedButShouldNot(parentNode, newNodeHolder.getValue(), event)) {
        return false;
    }

    // We need only one node marking NONE event that has not happened, so others are removed.
    parentNode.getChildren().subList(1, parentNode.getChildren().size()).clear();

    // Because an event hasn't happened, the value of the node will be set to null.
    TreeNode<NodeValue> emptyNode = parentNode.getChildren().get(0);
    if (emptyNode.getValue().getEvent() != null) {
        emptyNode.getValue().setEvent(null);
    }

    // Recursively build event tree because the event may match one of the following expected events for this rule.
    buildEventTree(emptyNode, event);

    // Add to event tree only when the event does match one of the following expected events.
    if (emptyNode.hasChildren()) {
        result = true;
    }

    // Change newNode in the holder for further processing.
    newNodeHolder.setValue(emptyNode);

    return result;
}
 
开发者ID:softelnet,项目名称:sponge,代码行数:32,代码来源:OrderedRuleAdapterRuntime.java


示例16: transform

import org.apache.commons.lang3.mutable.Mutable; //导入依赖的package包/类
@Override
public boolean transform(Mutable<ILogicalExpression> exprRef) {
    ILogicalExpression e = exprRef.getValue();
    switch (((AbstractLogicalExpression) e).getExpressionTag()) {
        case VARIABLE: {
            // Replace variable references with their equivalent representative in the equivalence class map.
            VariableReferenceExpression varRefExpr = (VariableReferenceExpression) e;
            LogicalVariable var = varRefExpr.getVariableReference();
            List<LogicalVariable> equivalentVars = equivalentVarsMap.get(var);
            if (equivalentVars == null) {
                return false;
            }
            LogicalVariable representative = equivalentVars.get(0);
            if (representative != var) {
                varRefExpr.setVariable(representative);
                return true;
            }
            return false;
        }
        case FUNCTION_CALL: {
            AbstractFunctionCallExpression funcExpr = (AbstractFunctionCallExpression) e;
            boolean modified = false;
            for (Mutable<ILogicalExpression> arg : funcExpr.getArguments()) {
                if (transform(arg)) {
                    modified = true;
                }
            }
            return modified;
        }
        default: {
            return false;
        }
    }
}
 
开发者ID:apache,项目名称:incubator-asterixdb-hyracks,代码行数:35,代码来源:RemoveRedundantVariablesRule.java


示例17: afce

import org.apache.commons.lang3.mutable.Mutable; //导入依赖的package包/类
private static ILogicalExpression afce(Function fn, boolean isTwoStep, ILogicalExpression... argExprs) {
    List<Mutable<ILogicalExpression>> args = new ArrayList<Mutable<ILogicalExpression>>();
    for (ILogicalExpression e : argExprs) {
        args.add(mutable(e));
    }
    return new AggregateFunctionCallExpression(fn, isTwoStep, args);
}
 
开发者ID:apache,项目名称:vxquery,代码行数:8,代码来源:XMLQueryTranslator.java


示例18: worthMaterialization

import org.apache.commons.lang3.mutable.Mutable; //导入依赖的package包/类
protected boolean worthMaterialization(Mutable<ILogicalOperator> candidate) {
    AbstractLogicalOperator aop = (AbstractLogicalOperator) candidate.getValue();
    if (aop.getPhysicalOperator().expensiveThanMaterialization()) {
        return true;
    }
    List<Mutable<ILogicalOperator>> inputs = candidate.getValue().getInputs();
    for (Mutable<ILogicalOperator> inputRef : inputs) {
        if (worthMaterialization(inputRef)) {
            return true;
        }
    }
    return false;
}
 
开发者ID:apache,项目名称:incubator-asterixdb-hyracks,代码行数:14,代码来源:ExtractCommonOperatorsRule.java


示例19: rewritePost

import org.apache.commons.lang3.mutable.Mutable; //导入依赖的package包/类
@Override
public boolean rewritePost(Mutable<ILogicalOperator> opRef, IOptimizationContext context)
        throws AlgebricksException {
    AbstractLogicalOperator op = (AbstractLogicalOperator) opRef.getValue();
    if (op.getOperatorTag() != LogicalOperatorTag.ASSIGN) {
        return false;
    }
    AssignOperator assignOp = (AssignOperator) op;

    // Find a join operator below this assign.
    Mutable<ILogicalOperator> joinOpRef = findJoinOp(assignOp.getInputs().get(0));
    if (joinOpRef == null) {
        return false;
    }
    AbstractBinaryJoinOperator joinOp = (AbstractBinaryJoinOperator) joinOpRef.getValue();

    // Check if the assign uses a function that we wish to push below the join if possible.
    funcExprs.clear();
    gatherFunctionCalls(assignOp, funcExprs);
    if (funcExprs.isEmpty()) {
        return false;
    }

    // Try to push the functions down the input branches of the join.
    boolean modified = false;
    if (pushDownFunctions(joinOp, 0, funcExprs, context)) {
        modified = true;
    }
    if (pushDownFunctions(joinOp, 1, funcExprs, context)) {
        modified = true;
    }
    if (modified) {
        context.computeAndSetTypeEnvironmentForOperator(joinOp);
    }
    return modified;
}
 
开发者ID:apache,项目名称:incubator-asterixdb-hyracks,代码行数:37,代码来源:PushFunctionsBelowJoin.java


示例20: rewritePost

import org.apache.commons.lang3.mutable.Mutable; //导入依赖的package包/类
@Override
public boolean rewritePost(Mutable<ILogicalOperator> opRef, IOptimizationContext context)
        throws AlgebricksException {
    ILogicalOperator op = opRef.getValue();
    if (context.getOutputTypeEnvironment(op) != null) {
        return false;
    }
    context.computeAndSetTypeEnvironmentForOperator(op);
    return true;
}
 
开发者ID:apache,项目名称:incubator-asterixdb-hyracks,代码行数:11,代码来源:InferTypesRule.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java MarcReader类代码示例发布时间:2022-05-22
下一篇:
Java AtCommandResponse类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap