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


Java MutableObject类代码示例

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


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

示例1: doGetVariable

import org.apache.commons.lang3.mutable.MutableObject; //导入依赖的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: shouldAllowSameMethodRegistrationFromDifferentThreads

import org.apache.commons.lang3.mutable.MutableObject; //导入依赖的package包/类
@Test
public void shouldAllowSameMethodRegistrationFromDifferentThreads() throws Exception {

    final MutableObject<StateMachineDefinition> definitionOne = new MutableObject<>(null);
    final MutableObject<StateMachineDefinition> definitionTwo = new MutableObject<>(null);

    final Thread thread1 = new Thread(() -> {
        localContext.registerNew("fooBar", 1, "someDescription","someContext");
        definitionOne.setValue(tlStateMachineDef.get());
    });
    final Thread thread2 = new Thread(() -> {
        localContext.registerNew("fooBar", 1, "someDescription","someContext");
        definitionTwo.setValue(tlStateMachineDef.get());
    });
    thread1.start();
    thread2.start();

    thread1.join();
    thread2.join();

    assertThat(definitionOne.getValue()).isNotNull().isEqualTo(definitionTwo.getValue()).isEqualTo(new StateMachineDefinition("someDescription", "fooBar", 1l, new HashSet<>(), new HashSet<>(), "someContext"));
}
 
开发者ID:flipkart-incubator,项目名称:flux,代码行数:23,代码来源:LocalContextTest.java

示例3: render

import org.apache.commons.lang3.mutable.MutableObject; //导入依赖的package包/类
@JtwigFunction(name = "render")
public <T extends RenderedElement> String render(HttpServletRequest request, @Parameter T input) throws FunctionException {
    try {
        if (input == null || !input.isVisible()) {
            return "";
        }
        RenderedElementService renderedElementService = applicationContext.getBean(RenderedElementService.class);
        HookService hookService = applicationContext.getBean(HookService.class);
        final MutableObject<RenderedElement> elementToRender = new MutableObject<>(input);
        if (!input.isWrapped()) {
            hookService.executeHook("element_wrapper", (c, o) -> {
                if (o != null && o instanceof RenderedElement && !input.isWrapped()) {
                    input.setWrapped(true);
                    elementToRender.setValue((RenderedElement) o);
                }
            }, input);
        }
        hookService.executeHook("element_alter", elementToRender.getValue());
        ModelAndView modelAndView = renderedElementService.convertToModelAndView(elementToRender.getValue());
        return render(request, modelAndView);
    } catch (Exception ex) {
        throw new FunctionException(ex);
    }
}
 
开发者ID:thunderbird,项目名称:pungwecms,代码行数:25,代码来源:TemplateFunctions.java

示例4: getAggregateOperator

import org.apache.commons.lang3.mutable.MutableObject; //导入依赖的package包/类
private AggregateOperator getAggregateOperator(IFunctionInfo aggregateFunction,
        Mutable<ILogicalExpression> aggregateArgs, LogicalVariable aggregateVariable) {
    List<LogicalVariable> aggregateVariables = new ArrayList<LogicalVariable>();
    aggregateVariables.add(aggregateVariable);

    List<Mutable<ILogicalExpression>> aggregateSequenceArgs = new ArrayList<Mutable<ILogicalExpression>>();
    aggregateSequenceArgs.add(aggregateArgs);

    List<Mutable<ILogicalExpression>> exprs = new ArrayList<Mutable<ILogicalExpression>>();
    ILogicalExpression aggregateExp = new AggregateFunctionCallExpression(aggregateFunction, false,
            aggregateSequenceArgs);
    Mutable<ILogicalExpression> aggregateExpRef = new MutableObject<ILogicalExpression>(aggregateExp);
    exprs.add(aggregateExpRef);

    return new AggregateOperator(aggregateVariables, exprs);
}
 
开发者ID:apache,项目名称:vxquery,代码行数:17,代码来源:ConvertAssignToAggregateRule.java

示例5: rewriteGroupByAggregate

import org.apache.commons.lang3.mutable.MutableObject; //导入依赖的package包/类
private void rewriteGroupByAggregate(LogicalVariable oldAggVar, GroupByOperator gbyOp,
        AggregateFunctionCallExpression aggFun, LogicalVariable newAggVar, IOptimizationContext context)
                throws AlgebricksException {
    for (int j = 0; j < gbyOp.getNestedPlans().size(); j++) {
        AggregateOperator aggOp = (AggregateOperator) gbyOp.getNestedPlans().get(j).getRoots().get(0).getValue();
        int n = aggOp.getVariables().size();
        for (int i = 0; i < n; i++) {
            LogicalVariable v = aggOp.getVariables().get(i);
            if (v.equals(oldAggVar)) {
                AbstractFunctionCallExpression oldAggExpr = (AbstractFunctionCallExpression) aggOp.getExpressions()
                        .get(i).getValue();
                AggregateFunctionCallExpression newAggFun = new AggregateFunctionCallExpression(
                        aggFun.getFunctionInfo(), false, new ArrayList<Mutable<ILogicalExpression>>());
                for (Mutable<ILogicalExpression> arg : oldAggExpr.getArguments()) {
                    ILogicalExpression cloned = ((AbstractLogicalExpression) arg.getValue()).cloneExpression();
                    newAggFun.getArguments().add(new MutableObject<ILogicalExpression>(cloned));
                }
                aggOp.getVariables().add(newAggVar);
                aggOp.getExpressions().add(new MutableObject<ILogicalExpression>(newAggFun));
                context.computeAndSetTypeEnvironmentForOperator(aggOp);
                break;
            }
        }
    }
}
 
开发者ID:apache,项目名称:vxquery,代码行数:26,代码来源:PushAggregateIntoGroupbyRule.java

示例6: getAggregateOperator

import org.apache.commons.lang3.mutable.MutableObject; //导入依赖的package包/类
private AggregateOperator getAggregateOperator(LogicalVariable unnestVariable, LogicalVariable aggregateVariable) {
    List<LogicalVariable> aggregateVariables = new ArrayList<LogicalVariable>();
    aggregateVariables.add(aggregateVariable);

    List<Mutable<ILogicalExpression>> aggregateSequenceArgs = new ArrayList<Mutable<ILogicalExpression>>();
    Mutable<ILogicalExpression> unnestVariableRef = new MutableObject<ILogicalExpression>(
            new VariableReferenceExpression(unnestVariable));
    aggregateSequenceArgs.add(unnestVariableRef);

    List<Mutable<ILogicalExpression>> exprs = new ArrayList<Mutable<ILogicalExpression>>();
    ILogicalExpression aggregateExp = new AggregateFunctionCallExpression(BuiltinOperators.SEQUENCE, false,
            aggregateSequenceArgs);
    Mutable<ILogicalExpression> aggregateExpRef = new MutableObject<ILogicalExpression>(aggregateExp);
    exprs.add(aggregateExpRef);

    return new AggregateOperator(aggregateVariables, exprs);
}
 
开发者ID:apache,项目名称:vxquery,代码行数:18,代码来源:ConvertAssignSortDistinctNodesToOperatorsRule.java

示例7: traverse

import org.apache.commons.lang3.mutable.MutableObject; //导入依赖的package包/类
public static Result traverse( SchemaAST root, String path ) {
    SchemaAST schemaAST = root;
    val additionalProperties = new MutableObject<Boolean>( null );

    final Supplier<Result> empty = () -> new Result( Optional.empty(), Optional.ofNullable( additionalProperties.getValue() ) );

    for( val item : StringUtils.split( path, '.' ) ) {
        if( schemaAST instanceof ObjectSchemaAST ) {
            val objectSchemaAST = ( ObjectSchemaAST ) schemaAST;
            schemaAST = objectSchemaAST.properties.get( item );
            objectSchemaAST.additionalProperties.ifPresent( additionalProperties::setValue );
            if( schemaAST == null )
                return empty.get();
        } else if( schemaAST instanceof ArraySchemaAST ) {
            if( !"items".equals( item ) )
                return empty.get();
            schemaAST = ( ( ArraySchemaAST ) schemaAST ).items;
        } else {
            return empty.get();
        }
    }

    return new Result( Optional.of( schemaAST ), Optional.ofNullable( additionalProperties.getValue() ) );
}
 
开发者ID:oaplatform,项目名称:oap,代码行数:25,代码来源:SchemaPath.java

示例8: buildVarExprList

import org.apache.commons.lang3.mutable.MutableObject; //导入依赖的package包/类
private Map<LogicalVariable, LogicalVariable> buildVarExprList(Collection<LogicalVariable> vars,
        IOptimizationContext context, GroupByOperator g,
        List<Pair<LogicalVariable, Mutable<ILogicalExpression>>> outVeList) throws AlgebricksException {
    Map<LogicalVariable, LogicalVariable> m = new HashMap<LogicalVariable, LogicalVariable>();
    for (LogicalVariable ov : vars) {
        LogicalVariable newVar = context.newVar();
        ILogicalExpression varExpr = new VariableReferenceExpression(newVar);
        outVeList.add(new Pair<LogicalVariable, Mutable<ILogicalExpression>>(ov,
                new MutableObject<ILogicalExpression>(varExpr)));
        for (ILogicalPlan p : g.getNestedPlans()) {
            for (Mutable<ILogicalOperator> r : p.getRoots()) {
                OperatorManipulationUtil.substituteVarRec((AbstractLogicalOperator) r.getValue(), ov, newVar, true,
                        context);
            }
        }
        AbstractLogicalOperator opUnder = (AbstractLogicalOperator) g.getInputs().get(0).getValue();
        OperatorManipulationUtil.substituteVarRec(opUnder, ov, newVar, true, context);
        m.put(ov, newVar);
    }
    return m;
}
 
开发者ID:apache,项目名称:incubator-asterixdb-hyracks,代码行数:22,代码来源:IntroduceGroupByForSubplanRule.java

示例9: createAssignBelowUnionAllBranch

import org.apache.commons.lang3.mutable.MutableObject; //导入依赖的package包/类
private AssignOperator createAssignBelowUnionAllBranch(UnionAllOperator unionOp, int inputIndex,
        AssignOperator originalAssignOp, Set<LogicalVariable> assignUsedVars, IOptimizationContext context)
                throws AlgebricksException {
    AssignOperator newAssignOp = cloneAssignOperator(originalAssignOp, context);
    newAssignOp.getInputs()
            .add(new MutableObject<ILogicalOperator>(unionOp.getInputs().get(inputIndex).getValue()));
    unionOp.getInputs().get(inputIndex).setValue(newAssignOp);
    int numVarMappings = unionOp.getVariableMappings().size();
    for (int i = 0; i < numVarMappings; i++) {
        Triple<LogicalVariable, LogicalVariable, LogicalVariable> varMapping = unionOp.getVariableMappings().get(i);
        if (assignUsedVars.contains(varMapping.third)) {
            LogicalVariable replacementVar;
            if (inputIndex == 0) {
                replacementVar = varMapping.first;
            } else {
                replacementVar = varMapping.second;
            }
            VariableUtilities.substituteVariables(newAssignOp, varMapping.third, replacementVar, context);
        }
    }
    context.computeAndSetTypeEnvironmentForOperator(newAssignOp);
    return newAssignOp;
}
 
开发者ID:apache,项目名称:incubator-asterixdb-hyracks,代码行数:24,代码来源:PushAssignBelowUnionAllRule.java

示例10: buildOperatorChain

import org.apache.commons.lang3.mutable.MutableObject; //导入依赖的package包/类
private ILogicalOperator buildOperatorChain(List<ILogicalOperator> ops, ILogicalOperator bottomOp,
        IOptimizationContext context) throws AlgebricksException {
    ILogicalOperator root = ops.get(0);
    ILogicalOperator prevOp = root;
    for (int i = 1; i < ops.size(); i++) {
        ILogicalOperator inputOp = ops.get(i);
        prevOp.getInputs().clear();
        prevOp.getInputs().add(new MutableObject<ILogicalOperator>(inputOp));
        prevOp = inputOp;
    }
    if (bottomOp != null) {
        context.computeAndSetTypeEnvironmentForOperator(bottomOp);
        prevOp.getInputs().clear();
        prevOp.getInputs().add(new MutableObject<ILogicalOperator>(bottomOp));
    }
    return root;
}
 
开发者ID:apache,项目名称:incubator-asterixdb-hyracks,代码行数:18,代码来源:ComplexUnnestToProductRule.java

示例11: enforceOrderProperties

import org.apache.commons.lang3.mutable.MutableObject; //导入依赖的package包/类
private Mutable<ILogicalOperator> enforceOrderProperties(List<LocalOrderProperty> oList,
        Mutable<ILogicalOperator> topOp, boolean isMicroOp, IOptimizationContext context)
                throws AlgebricksException {
    List<Pair<IOrder, Mutable<ILogicalExpression>>> oe = new LinkedList<Pair<IOrder, Mutable<ILogicalExpression>>>();
    for (LocalOrderProperty orderProperty : oList) {
        for (OrderColumn oc : orderProperty.getOrderColumns()) {
            IOrder ordType = (oc.getOrder() == OrderKind.ASC) ? OrderOperator.ASC_ORDER : OrderOperator.DESC_ORDER;
            Pair<IOrder, Mutable<ILogicalExpression>> pair = new Pair<IOrder, Mutable<ILogicalExpression>>(ordType,
                    new MutableObject<ILogicalExpression>(new VariableReferenceExpression(oc.getColumn())));
            oe.add(pair);
        }
    }
    OrderOperator oo = new OrderOperator(oe);
    oo.setExecutionMode(AbstractLogicalOperator.ExecutionMode.LOCAL);
    if (isMicroOp) {
        oo.setPhysicalOperator(new InMemoryStableSortPOperator());
    } else {
        oo.setPhysicalOperator(new StableSortPOperator(physicalOptimizationConfig.getMaxFramesExternalSort()));
    }
    oo.getInputs().add(topOp);
    context.computeAndSetTypeEnvironmentForOperator(oo);
    if (AlgebricksConfig.DEBUG) {
        AlgebricksConfig.ALGEBRICKS_LOGGER.fine(">>>> Added sort enforcer " + oo.getPhysicalOperator() + ".\n");
    }
    return new MutableObject<ILogicalOperator>(oo);
}
 
开发者ID:apache,项目名称:incubator-asterixdb-hyracks,代码行数:27,代码来源:EnforceStructuralPropertiesRule.java

示例12: pushAllProjectionsOnTopOf

import org.apache.commons.lang3.mutable.MutableObject; //导入依赖的package包/类
private static boolean pushAllProjectionsOnTopOf(Collection<LogicalVariable> toPush,
        Mutable<ILogicalOperator> opRef, IOptimizationContext context, ILogicalOperator initialOp)
                throws AlgebricksException {
    if (toPush.isEmpty()) {
        return false;
    }
    AbstractLogicalOperator op = (AbstractLogicalOperator) opRef.getValue();

    if (context.checkAndAddToAlreadyCompared(initialOp, op)) {
        return false;
    }

    if (op.getOperatorTag() == LogicalOperatorTag.PROJECT) {
        return false;
    }

    ProjectOperator pi2 = new ProjectOperator(new ArrayList<LogicalVariable>(toPush));
    pi2.getInputs().add(new MutableObject<ILogicalOperator>(op));
    opRef.setValue(pi2);
    pi2.setExecutionMode(op.getExecutionMode());
    context.computeAndSetTypeEnvironmentForOperator(pi2);
    return true;
}
 
开发者ID:apache,项目名称:incubator-asterixdb-hyracks,代码行数:24,代码来源:PushProjectDownRule.java

示例13: visitIndexInsertDeleteUpsertOperator

import org.apache.commons.lang3.mutable.MutableObject; //导入依赖的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

示例14: visitTokenizeOperator

import org.apache.commons.lang3.mutable.MutableObject; //导入依赖的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

示例15: blockingSynchronize

import org.apache.commons.lang3.mutable.MutableObject; //导入依赖的package包/类
/**
 * Request a remote synchronization. This call blocks until the operation is complete,
 * or the thread is interrupted.
 * 
 * @throws InterruptedException
 */
public SynchronizeResult blockingSynchronize() throws InterruptedException
{
	log.info("Queuing a blocking sync request");
	final MutableObject<SynchronizeResult> result = new MutableObject<SynchronizeResult>();
	final CountDownLatch cdl = new CountDownLatch(1);
	Consumer<SynchronizeResult> callback = new Consumer<SynchronizeResult>()
	{
		@Override
		public void accept(SynchronizeResult t)
		{
			result.setValue(t);
			cdl.countDown();
		}
	};

	synchronize(callback);
	cdl.await();
	return result.getValue();
}
 
开发者ID:Apelon-VA,项目名称:ISAAC,代码行数:26,代码来源:RemoteSynchronizer.java


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